-
Notifications
You must be signed in to change notification settings - Fork 20
Description
DESCRIPTION
The configuration context module (src/common/context.c) currently lacks a cleanup mechanism to deallocate memory used for model parameter metadata.
During model initialization, createContextMetadata allocates memory for struct context_metadata using malloc to populate the ctx.metaMap hash table. However, there is no corresponding function to iterate through the hash table and free these allocations before the program terminates or when a model run is completed.
While the operating system reclaims memory upon process exit, this missing cleanup is a violation of memory management best practices. It poses a risk for future development if SIPNET is integrated into long-running processes, such as optimization loops or library calls, where repeated initializations would cause linear memory growth.
Solution
A cleanup function should be implemented to safely destroy the hash table and free all associated metadata structures.
I am working on this issue thanks
thanks !!