Re: [AD] memory leak in readbmp.c? |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
In reply to Peter Wang <tjaden@xxxxxxxxxx>: [snip - readbmp.c] >> Nope; the destructor frees the memory allocated by >> _register_bitmap_file_type_init(). > >Ok, I'll take your word for it. > >What about this? >$ mtrace examples/exalpha mtrace.log >- 0x080ebb10 Free 2474 was never alloc'd /home/tjaden/cvs/allegro/./src/readbmp. >c:166 [snip some more] Looks like `mtrace', whatever it is, doesn't record memory allocated in constructor functions. The readbmp.c free() calls are all cleaning up the linked list (check out the ctor to see that the memory is actually allocated), and the allegro.c free() call is removing the exit function (which was registered in the ctor). Perhaps `mtrace' uses a ctor function to register itself? If that is the case, the order of ctor calls is not guaranteed (the only thing we can take for granted is that simple variables -- those without a ctor -- will be initialised first. This lets us build linked lists from global pointers, etc.) Bye for now, -- Laurence Withers, lwithers@xxxxxxxxxx http://www.lwithers.demon.co.uk/
Attachment:
signature.asc
Description: PGP signature
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |