Proper way to release memory loaded by hkLoader?

Proper way to release memory loaded by hkLoader?

So I've used the demos (Skeletal Animation, specifically..) to get my own example program working. Following in the demos' footsteps, I'm using hkLoader to read my .HKX skeleton and animation files- everything is loading succesfully, and rendering correctly in my system, and I can continue to load additional .HKX animation files to view on the skeleton. However, now I'd like the option to UNload a bunch of those .HKX files...

I suppose it would be technically acceptable to unload everything that has been loaded by the hkLoader blindly, but ideally, I'd like the option to unload only specific files. I haven't found any functions that will allow me to achieve this, however I see hkLoader.m_loadedData... Am I supposed to be finding my files in there, calling their removeReference() functions, and then removing them from hkLoader.m_loadedData? It seems a little strange that I should have to do all this manually, so I can't help but feel that I must be missing something somewhere...?

2 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

Hi Jed L.--

The primary purpose of the loader is precisely to maintain a list of references to all loaded objects for the duration of an application. If you want fine-grained control over which files to save and which to unload, you should write your own asset manager that calls hkSerializeUtil::load() directly for each resource (which is what hkLoader does under the hood). You can then write custom code to determine which resources to keep around, and which you want to unload (by calling removeReference()).

Please let me know if you have any further questions. Thanks!


Lascia un commento

Eseguire l'accesso per aggiungere un commento. Non siete membri? Iscriviti oggi