Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
Garbage collection in C
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Mark Gordon, post: 1672711"] The point was that if the external library passes you a pointer that you are expected to free, then after your redefinition of free the following code fragment gives a memory leak { char *derf; derf = foo(); /* foo is in library and returns pointer from malloc */ /* do some stuff */ free(derf); } I would also point out that if you don't have to free some dynamically allocated memory but other pieces of dynamically allocated memory do need freeing you (or at least I) am more likely to make a mistake and either use the standard free on a pointer that should be left for the GC or not call it on a pointer to memory provided (though a library) by malloc. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Garbage collection in C
Top