Top "Free" questions

Do not use this tag to refer to free software.

free() on stack memory

I'm supporting some c code on Solaris, and I've seen something weird at least I think it is: char new_…

c memory-management garbage-collection stack free
ASAN heap use after free

I am running ASAN for finding memory leaks in a very big project. I have found out the cause, but …

c malloc heap free address-sanitizer
Calling free on a pointer twice

I have been taught in lectures, that calling free() on a pointer twice is really, really bad. I know that …

c pointers malloc free dynamic-memory-allocation
does exit() free allocated memory on both _SUCCESS and _FAILURE

This a short snippet of code, with two calls to exit(3) in case of failure. Do these calls deallocate memory …

c malloc free exit
Cannot free memory after using strdup

gcc 4.5.1 c89 I am trying to free some memory. However, when I check with valgrind the memory hasn't been freed. …

c free strdup
C - Design your own free( ) function

Today, I appeared for an interview and the interviewer asked me this, Tell me the steps how will you design …

c malloc free
Determining Whether Pointer is Valid

It has been my observation that if free( ptr ) is called where ptr is not a valid pointer to system-allocated …

c++ memory pointers free
Malloc and free: memory being freed was not allocated

The following is from the Libaiff library. I get the following error completely randomly (i.e. sometimes my program works …

c memory-management malloc free aiff
How to "free" variable after end of the function?

what is the right way to free an allocated memory after executing function in C (via malloc)? I need to …

c pointers malloc free
Why doesn't CudaFree seem to free memory?

I am trying to allocate device memory, copy to it, perform the calculations on the GPU, copy the results back …

memory cuda free