Thanks Mike! I'm not sure that's exactly what I'm after though - I assume this 
will just mean Nuke will call freeCallback every so often when it thinks more 
memory might be needed? I guess that will be helpful if Nuke is keeping a load 
of my Ops around for the sake of undo, however since I'm allocating my buffers 
in shared memory (i.e. not in the Nuke process), how will that play with Nuke's 
assesment of whether it's time to call freeCallback() or not? I would have 
thought Nuke would have no idea about my memory in this case?

Josh's suggestion of overriding _close() sounds interesting. Is _close() 
guaranteed to be called for each Op when Nuke exits?

Cheers,

Anders

-----------------------
Anders Langlands
x8382/+447789206593
________________________________
From: Kin Ming Mike WONG [[email protected]]
Sent: 09 July 2012 15:20
To: Nuke plug-in development discussion
Subject: Re: [Nuke-dev] Op destructor does not get called?

Anders,

yes, undo is a case and some good read from this thread:

 
http://forums.thefoundry.co.uk/phpBB2/viewtopic.php?t=6862&postdays=0&postorder=asc&start=15

Implement the DDImage::Memory() class interface (the callbacks) will make Nuke 
inform your op to release memory when needed.  example code available in 
tiffreader.cpp

best,

Mike

On Monday, July 9, 2012, Anders Langlands wrote:
I'm finding that Nuke will sometimes destroy my Op, and sometimes not. If I 
create half a dozen plugin nodes then delete them, maybe 2 will call 
MyOp::~MyOp(). Then when I quit Nuke, those destructors still won't be called.

In my particular plugin I allocate ~25MB of interprocess shared memory per Op, 
so leaving this hanging around is a bit of a deal. Is this something to do with 
the undo functionality or something else that I can turn off? Is there some 
other hook I can use that *is* guaranteed to be called when an Op is no longer 
needed?

Cheers,

Anders


-----------------------
Anders Langlands
x8382/+447789206593
_______________________________________________
Nuke-dev mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev

Reply via email to