On Fri, Oct 10, 2008 at 7:39 PM, barnabas79 <[EMAIL PROTECTED]> wrote:
>
> swig/python detected a memory leak of type 'MCallbackId *', no
> destructor found.
>
> After a quick search, I see that it was mentioned back in January by
> Farsheed, and a few others since then, so I assume it's a known bug...
> so I won't go into the details.  (Though it seems it's still there in
> 2009, alas...)

It's a well known bug. There is in fact no leak. swig thinks there is
because it thinks that MCallbackId is a complex allocated type when in
fact it is a simple type being passed by value. Invoking the correct
juju to satisfy swig has proven...challenging. So while the warning is
annoying you are safe to just ignore it.

> Anyway, I came across it because I was trying to get some sort of
> notification when a node is deleted... Unfortunately, there's no
> scriptJob condition / event / option that notifies of node deletion
> (not that I could find, anyway), so I tried this:
>
> http://pastebin.com/f4a2026cf
>
> ...but that gave me the aforementioned ominous memory leak warning.
> (If you don't see it, check your console output window...)

In that specific example you can eliminate the warning message by
assigning the callback id returned by the
addNodeAboutToDeleteCallback() to a variable. However if you
subsequently try to assign a different value to that variable then
swig will try to destroy the old callback id and you'll get the
warning message at that time.

So you could keep a list containing all of your callback ids, creating
a new list entry for each one. That would eliminate the warning
message while, perversely, creating a *real* memory leak. But at least
the leak would be under your control.

-- 
-deane

--~--~---------~--~----~------------~-------~--~----~
Yours,
Maya-Python Club Team.
-~----------~----~----~----~------~----~------~--~---

Reply via email to