As the library grows into a more concrete and highly composite one, there arrive a lot of issues with garbage cleaning and how we handle disconnecting events, destroying objects and instances. As of now, we just don't care about memory leaks! And yes, that is true. We are just hoping, that we don't run into such problems. And this hope dies down as we start using Nature2D for full fledged projects.
Problems that exist:
:Destroy() methods aren't implemented properly.
There is no way to destroy the Engine and its entities as a whole.
There's no way to destroy points properly without messing up other objects.
Destroying GuiObjects of constraints, points and rigid bodies doesn't destroy their objects (classes) subsequently.
Its hard to implement garbage cleaning in a library with such a versatile hierarchy of physics objects, without using a maid class.
For situations like destroying points - we disconnect all events, destroy GuiObjects and its class, its parent constraint and the parent rigid body of the constraint (if any). This is hard to implement with current ways of garbage cleaning.
The library is prone to have memory leaks, but this pull request aims to solve all problems related to memory leaks and garbage cleaning using Janitor. This PR will remain a draft until all changes have been proposed and revised.
As the library grows into a more concrete and highly composite one, there arrive a lot of issues with garbage cleaning and how we handle disconnecting events, destroying objects and instances. As of now, we just don't care about memory leaks! And yes, that is true. We are just hoping, that we don't run into such problems. And this hope dies down as we start using Nature2D for full fledged projects.
Problems that exist:
:Destroy()
methods aren't implemented properly.The library is prone to have memory leaks, but this pull request aims to solve all problems related to memory leaks and garbage cleaning using Janitor. This PR will remain a draft until all changes have been proposed and revised.