Recomment PR #6346.

This commit is contained in:
antirez 2019-11-21 10:01:49 +01:00
parent fef1e63c70
commit da47d52c79

View File

@ -5995,19 +5995,23 @@ int RM_CommandFilterArgDelete(RedisModuleCommandFilterCtx *fctx, int pos)
return REDISMODULE_OK; return REDISMODULE_OK;
} }
/* /* For a given pointer allocated via RedisModule_Alloc() or
* For a given pointer, return The amount of memory * RedisModule_Realloc(), return the amount of memory allocated for it.
* allocated for this pointer. * Note that this may be different (larger) than the memory we allocated
* with the allocation calls, since sometimes the underlying allocator
* will allocate more memory.
*/ */
size_t RM_MallocSize(void* ptr){ size_t RM_MallocSize(void* ptr){
return zmalloc_size(ptr); return zmalloc_size(ptr);
} }
/* /* Return the a number between 0 to 1 indicating the amount of memory
* Return the a number between 0 to 1 indicating * currently used, relative to the Redis "maxmemory" configuration.
* the amount of memory currently used. *
* 0 - no memory limit * 0 - No memory limit configured.
* 1 and above, memory limit reached. * Between 0 and 1 - The percentage of the memory used normalized in 0-1 range.
* Exactly 1 - Memory limit reached.
* Greater 1 - More memory used than the configured limit.
*/ */
float RM_GetUsedMemoryRatio(){ float RM_GetUsedMemoryRatio(){
float level; float level;