Hi folks, I've been thinking for a while (since writing the first lines of code) that libredwg is a big memory leak. Memory is allocated but never freed. There are 2 options, AFAIK:
1. dellocate memory manually. I thought about using dwg.spec + redefining the decode.c macros, using free when a malloc has been used in decode.c, to create a void dwg_free (Dwg_Data* data) function. 2. use libgc (garbage collector), allocate everything with GC_MALLOC() and never think about deallocation again. Option 1 seems cumbersome to maintain. Some /mallocs/ are used outside of macros/spec scope. Besides, the users have to be instructed to always dwg_free() - specially bad in a (still) hypothetic situation where the user is using libredwg through python bindings. Option 2 seems too 'easy' and weird. Is it common to use a garbage collector inside a library? If the client program uses libgc as well, is that possible that lib and program conflict? Please let me know what you think. -- Rodrigo Rodrigues da Silva PoliGNU - Grupo de Estudos de Software Livre da Poli/USP GNU Project
signature.asc
Description: OpenPGP digital signature
