Skip to content

Call malloc_trim(3) Before Reload to Release Unused Memory🧠 #10302

Open
@Al2Klimov

Description

Is your feature request related to a problem? Please describe.

Currently, memory that has been allocated and not released is often retained by the current process. While this can benefit the same process when it mallocs more memory (re-usage), it doesn't help other processes, including a new main process during a reload. As a result, the system may be inefficient in terms of memory utilization across reloads.

Describe the solution you'd like

Before every reload attempt, the main process should call malloc_trim(3) if available to release unused memory back to the system. This would allow the system to free up memory that may no longer be needed, helping with overall memory efficiency and preventing wasted space for other processes, including newly spawned ones.

Describe alternatives you've considered

Additional context

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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