IhtkaS
IhtkaS

Reputation: 1424

auto memory management for RedisModule_Alloc() in Redis

Inside a Redis module, we can let the Redis manages memory automatically. Redis document says this

When automatic memory management is enabled:

  1. You don't need to close open keys.
  2. You don't need to free replies.
  3. 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

Answers (1)

Itamar Haber
Itamar Haber

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

Related Questions