Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
46b07cbb
Commit
46b07cbb
authored
May 19, 2016
by
Dvir Volk
Browse files
Optimized autoMemoryFreed loop
parent
b09a6b6a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/module.c
View file @
46b07cbb
...
...
@@ -580,7 +580,7 @@ void autoMemoryFreed(RedisModuleCtx *ctx, int type, void *ptr) {
if (!(ctx->flags & REDISMODULE_CTX_AUTO_MEMORY)) return;
int j;
for (j =
0; j <
ctx->amqueue_used
; j++
) {
for (j = ctx->amqueue_used
- 1; j >= 0; j--
) {
if (ctx->amqueue[j].type == type &&
ctx->amqueue[j].ptr == ptr)
{
...
...
@@ -588,6 +588,9 @@ void autoMemoryFreed(RedisModuleCtx *ctx, int type, void *ptr) {
/* Optimization: if this is the last element, we can
* reuse it. */
if (j == ctx->amqueue_used-1) ctx->amqueue_used--;
break;
}
}
}
...
...
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