LWN.net Logo

Not everything is a nail...

Not everything is a nail...

Posted Jan 25, 2011 16:41 UTC (Tue) by etienne (subscriber, #25256)
In reply to: Not everything is a nail... by jrn
Parent article: Sobotka: Why GIMP is inadequate

Maybe you do not have the problem of freeing memory when a local structure goes out of scope in C (outside of kernel space), because in that case the local structure is declared in the stack and will be freed automatically...
Maybe the real problem is that your "autoptr" is not able to manage an object in the stack, but you need an "autoptr" because one method has such an argument.


(Log in to post comments)

Not everything is a nail...

Posted Jan 25, 2011 22:18 UTC (Tue) by daglwn (subscriber, #65432) [Link]

Will that local structure also close files for me when it goes out of scope? Or does that local structure free memory pointed to by members of that structure when it goes out of scope? Or does that local structure release a lock it holds when it goes out of scope?

RAII is about MUCH more than memory.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds