i want to know why line 4 not "AtomicIncr(used_memory, _n); \", why actomic add "__n", thanks! 1 #define update_zmalloc_stat_alloc(__n) do { \ 2 size_t _n = (__n); \ 3 if (_n&(sizeof(long)-1)) _n += sizeof(long)-(_n&(sizeof(long)-1)); \ 4 AtomicIncr(used_memory,__n); \ 5 } while(0)
Comment From: fielder
#define update_zmalloc_stat_alloc(__n) do { \\
size_t _n = (__n); \\
if (_n&(sizeof(long)-1)) _n += sizeof(long)-(_n&(sizeof(long)-1)); \\
atomicIncr(used_memory,__n); \\
} while(0)
#define update_zmalloc_stat_free(__n) do { \\
size_t _n = (__n); \\
if (_n&(sizeof(long)-1)) _n += sizeof(long)-(_n&(sizeof(long)-1)); \\
atomicDecr(used_memory,__n); \\
} while(0)
I'm guessing an oversight. It looks like this is an estimated value so used_memory may not matter if it drifts.