Reputation: 1424
Inside a Redis module, we can let the Redis manages memory automatically. Redis document says this
When automatic memory management is enabled:
- You don't need to close open keys.
- You don't need to free replies.
- You don't need to free RedisModuleString objects.
Apart from these, Does Redis free the memory allocated using RedisModule_Alloc() also? Or Does the developer have to free them manually?
Upvotes: 0
Views: 157
Reputation: 49962
Memory allocated by RedisModule_Alloc()
, RedisModule_Calloc()
and RedisModule_Realloc()
needs to be explicitly freed by the module via a call to RedisModule_Free()
.
For reference, look at the native type's example callback for freeing the type - https://redis.io/topics/modules-native-types#free-method
Upvotes: 2