Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

SDK: Modifier destructor

SDK: Modifier destructor

Anonymous
Not applicable
716 Views
4 Replies
Message 1 of 5

SDK: Modifier destructor

Anonymous
Not applicable

I'm working on a plugin that derives from Modifier and noticed something odd. When I delete my modifier (I have a simple test scene with just one object and my modifier applied to it) and call gc() right after that, the destructor for the modifier is not called. In fact, it never gets called, even when I close max.

 

However, when I delete the object instead of the modifier, and then call gc(), the destructor of my modifier does get called.

 

Is this the expected behaviour, or am I doing something wrong? Unfortunately I can't post my code here, but hopefully it's just a simple thing that I'm overlooking.

 

Thanks,

Martijn

0 Likes
Accepted solutions (1)
717 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
I should note that the destructor is also NOT called when I first delete the modifier, then the node and then call gc(). Very weird
0 Likes
Message 3 of 5

Anonymous
Not applicable
Ok, I've just tested it with a sample modifier (relax) and the same thing happens. This is in 2012 x64 btw, not sure if the issue is caused by something that has been fixed in later versions of max.

Seems like quite a nasty bug though, because it means that any memory allocated by the modifier will not be freed until max is closed, even though the modifier has been deleted from the scene long ago and the garbage collector (should) already have disposed of it.
0 Likes
Message 4 of 5

Anonymous
Not applicable
Accepted solution
It works as expected in 2013 so I guess this was a bug in the 2012 SDK (and probably earlier versions)..
0 Likes
Message 5 of 5

Anonymous
Not applicable

This like it is not solved for a object plugin in 3ds max 2016.  The same problem.

0 Likes