On windows, all you have to do is hook the WndProc using SetWindowsHookEx:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms644990%28v=vs.85%2
9.aspx

And then watch for the WM_ENDSESSION windows message:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa376889%28v=vs.85%2
9.aspx

This informs the user that the windows-based process (which of course, Nuke
is) is terminating.  You can deallocate the shared resources here.

Steve


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Wouter
Klouwen
Sent: Monday, July 09, 2012 7:56 AM
To: [email protected]
Subject: Re: [Nuke-dev] Op destructor does not get called?

On 09/07/2012 15:42, Steve Booth wrote:
> Also note, Anders, that nothing is left hanging. Even though your 
> destructors are not called, all heap-allocated space associated with a 
> process is automatically freed when the process terminates. So, when 
> you exit Nuke, you get your memory back.

The problem with shared memory is that it must be explicitly deallocated. If
the reference from his plug-in is not cleaned up the OS will (incorrectly)
think that it can't free that chunk.
So yes, while heap allocated space may be reclaimed, that's not the case
with shared memory.

For some more background, I suggest reading about POSIX Shared Memory:

http://www.cs.cf.ac.uk/Dave/C/node27.html


HTH,
     Wouter

--
Wouter Klouwen, Software Engineer
The Foundry, 6th Floor, Comms Building, 48 Leicester Sq, London WC2H LT
Tel: +442079686828 . Fax: +4420 79308906 . thefoundry.co.uk The Foundry
Visionmongers Ltd . Reg.d in England and Wales No: 4642027


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

_______________________________________________
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