Hi,I think these functions exist problems. the code #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)
should be #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) am I right? Hope your response. Thank you.
Comment From: LIncoLNXin
i think so too. hope someone can explain it.
Comment From: shinchan299
I think so too. ISSUE #4739
Comment From: yeefea
The redundant code is removed in this commit. This issue can be closed. @antirez
Comment From: oranagra
thanks @Blueswing.
p.s. the above suggested code actually seems like a bug (use _n which was unused).
this code seems leftover from an old mechanism, see the commit comment in the commit mentioned above.