Memory management | Sololearn: Learn to code for FREE!


Memory management

Someone know if there is a function allowing to release more than one pointer once. Instead of doing : free(fptr) free(fptr1) free(fptr2)

5/28/2020 9:51:32 PM

Honorable Con 🇸🇳

10 Answers

New Answer



you will have to create such function yourself


Zia sahebi But closing the program does not automatically free allocated data so the program will leak memory (which may or may not be reclaimed by the operating system) and even if it does, it's a bad practice and not something you can expect if you want your program to be portable.



In C++, you could do this quiet easily with template parameters:


i say instead of doing many free(..) is it a function in standard library can do that once. exemple : function_delete(ptr1, ptr2...)


yea i can do it but i would be sure that he doesn't exist


No there is no way to free all of your alloced heap memory at once except closing your programm!


Gen2oo Usually every OS has an memory protection to avoid occur OS memory leak