Re: mem leaks win32 call_back
- Posted by mattlewis (admin) Jan 23, 2010
- 1444 views
first, apologies if i'm posting to the wrong place
No, this is a good place to post this sort of thing.
after taking a look at the sources (.c and dll.e) it does appear
that call_back is allocating memory for function pointer handles
under windows.
is there any way to reclaim the memory allocated?
i am almost complete with writing an LGP (linear genetic programming)
library, that uses call_back() extensively (loads eui dlls as plugins,
then fixes up function pointers)
Yes, each call back allocates some memory, and as I think you've noticed, under windows, there are actually two allocations. Ideally, the callback wrapper in dll.e would be a thin wrapper around the MACHINE_FUNC call. There is actually a ticket open to do this (ticket:111).
At a minimum, though, this leak should be plugged. To do so, try adding a call to free(addr) before call_back() returns. Let us know if this works, and we can patch the code temporarily, until the real issue can be dealt with. The current implementation of call_back() allocates in blocks, and there's no way to reclaim individual callback allocations.
Matt