On Sun, May 8, 2011 at 1:39 PM, Nitralime nitralime@googlemail.com wrote:
What would be a correct solution to avoid memory leaks in this situation? Using a finalizer seems to be a possible way to go. But I'm not sure how this can be done by just using the finalizer parameters "object" and "function" where "function" can't reliablely access "object" (cf. documentation of finalizer in "trivial-garbage" package)!!
Here's some pseudo-code to achieve what you're looking for:
(let ((ptr (grab-your-table-pointer))) (tg:finalize your-wrapper-object (lambda () (table-free ptr))))
HTH,