Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MeirShpilraien committed Jul 23, 2024
1 parent 883c8cd commit c5a55c0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/zmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ void zlibc_free(void *ptr) {
#include <string.h>
#include "zmalloc.h"
#include "atomicvar.h"
#include "redisassert.h"

#define UNUSED(x) ((void)(x))

Expand Down Expand Up @@ -461,17 +462,18 @@ char *zstrdup(const char *s) {

size_t zmalloc_used_memory(void) {
size_t local_num_active_threads;
size_t totol_mem = 0;
long long total_mem = 0;
atomicGet(num_active_threads,local_num_active_threads);
if (local_num_active_threads > MAX_THREADS) {
local_num_active_threads = MAX_THREADS;
}
for (size_t i = 0; i < local_num_active_threads; ++i) {
long long thread_used_mem;
atomicGet(used_memory[i].used_memory, thread_used_mem);
totol_mem += thread_used_mem;
total_mem += thread_used_mem;
}
return totol_mem;
assert(total_mem >= 0);
return total_mem;
}

void zmalloc_set_oom_handler(void (*oom_handler)(size_t)) {
Expand Down Expand Up @@ -688,8 +690,6 @@ size_t zmalloc_get_rss(void) {

#if defined(USE_JEMALLOC)

#include "redisassert.h"

/* Compute the total memory wasted in fragmentation of inside small arena bins.
* Done by summing the memory in unused regs in all slabs of all small bins.
*
Expand Down

0 comments on commit c5a55c0

Please sign in to comment.