Skip to content

Issue: Potential Memory Leak in Configuration Context #211

@ayushman1210

Description

@ayushman1210

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 !!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions