What about resources lifecycle

From what I understand from documentation, resources are loaded (and cached) from file system when fetched through loader. Either by macro (res/ path) or by calling load method.

Creating a scene in my game is simple. I create s2d.Object(s) provide them resources and all the loading stuff is done automatically.

My question is, how should I release resources (memory and gpu stuffs for textures) when my scene is over ?

Heaps is a very good framework but this part is not explicitly covered by documentation nor by samples.

Thank you for your answers.

Haxe is garbage collected. Having no reference to your object should be enough to have it flaged for collection. If you’re closing a scene you could explicitly set your varibles to null and call the gc to run.

Indeed.

My question was more about subsystem resource release. Like textures on GPU for example.

When is the texture on GPU released ? When Texture object is garbage collected or should I call an explicit method ?

Are resources cached by Loader ? Should I invalidate cache to make resources garbage collected ?

oh yeah sry. There seem to be a cache and some methods in hxd.res.Loader from what I see here hxd.res.Loader - Heaps.io Game Engine.
Every resources have a dispose(), isDisposed() and a preventAutoDispose().
the prevent auto dispose does assign lastFrame to PREVENT_AUTO_DISPOSE; and the comment is interesting:
/**
In case of out of GPU memory, textures that hasn’t been used for a long time will be disposed.
Calling this will make this texture not considered for auto disposal.
**/
That’d be great to have this clarified somewhere.