🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Deleting modules

Started by
0 comments, last by WitchLord 19 years ago
Is there a way to delete module when needed? My problem is that when I discard a module it isn't deleted since it has non zero context reference count. In my app, I have a pool of contexts from which I take unused one and execute function with it, at the moment I load 2 scripts, the second one is loaded during execution of the first one, so they have different contexts assigned to them. When I try to delete modules (engine->Discard), they're not deleted at all, even though none of them is executing.
Advertisement
They are not deleted since the contexts still hold references to them (as you accurately noted). The contexts free their references to the module when they themselves are released, or if they are prepared with another function.

The call to engine->Discard() only sets a flag for the module that says that it is not to be used anymore for new calls. You will not be able to prepare a context with a function from a discarded module. The module name is also freed so that you can compile another module reusing the name.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement