Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
d3277ecd
Commit
d3277ecd
authored
Apr 20, 2010
by
antirez
Browse files
More precise memory used guesswork in zmalloc.c
parent
66c8853f
Changes
1
Show whitespace changes
Inline
Side-by-side
zmalloc.c
View file @
d3277ecd
...
...
@@ -40,7 +40,9 @@
#define PREFIX_SIZE sizeof(size_t)
#endif
#define increment_used_memory(_n) do { \
#define increment_used_memory(__n) do { \
size_t _n = (__n); \
if (_n&(sizeof(long)-1)) _n += sizeof(long)-(_n&(sizeof(long)-1)); \
if (zmalloc_thread_safe) { \
pthread_mutex_lock(&used_memory_mutex); \
used_memory += _n; \
...
...
@@ -50,7 +52,9 @@
} \
} while(0)
#define decrement_used_memory(_n) do { \
#define decrement_used_memory(__n) do { \
size_t _n = (__n); \
if (_n&(sizeof(long)-1)) _n += sizeof(long)-(_n&(sizeof(long)-1)); \
if (zmalloc_thread_safe) { \
pthread_mutex_lock(&used_memory_mutex); \
used_memory -= _n; \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment