Program crushes after reaches x memory usage

How to release all memory related to current programm?
Tried to re execute with atexit, but still having the same memory usage till manually close program
It seems like you're asking a lot of short questions, with little explanation, that don't seem well-researched.

If you don't want memory leaks, you have to prevent the memory from leaking, meaning you have to hold onto the pointers/handles of the resources you allocate during the lifetime of the program, and free them. The OS will take back whatever memory your program claimed only after the program terminates.
Last edited on
How to release all memory related to current programm?

There is no standard method to release all memory for a program in one operation. For each allocation you have to release it individually. As mentioned above, the OS will release all memory used that has not already been released when a program terminates - although it's not considered good practice to rely on this.
Where should I start my research for memory release methods?
If you use new, then use delete.
if you use new [], then use delete []

if you use c memory functions (not advised for C++), then
if you use malloc() or calloc() then use free()

Each new/new [] requires a matching delete/delete []
Each malloc()/calloc() requires a matching free()

For C++, if you use managed pointers (std::shared_ptr/std::weak_ptr/std::unique_ptr) then you don't need to worry about memory release as it's done automatically when these objects go out of scope.

Topic archived. No new replies allowed.