Inability to unload an object from memory

Good afternoon/evening/morning.

The more I learn about PDA and AssetManager, the faster I go crazy.
Today I encountered a new problem: object (Primary Data Asset ) is not unloaded from memory.
I run ForceGC and check obj list class=ItemAssetData
and I still have all the loaded PDAs, even though no one has references to them

My PDA loading function:

And how i use this:

You’d think after loading it should unload the asset, but it doesn’t.
When I use the obj refs name=PDA_Wood command to see the references, I get this message:
PDA_Wood is not currently reachable but it does have some of GARBAGE_COLLECTION_KEEPFLAGS set.

But as soon as I added the line Asset->Asset->ClearFlags(RF_Standalone) everything worked.

Please tell me what I did wrong, maybe the problem is in lambda functions or something else
PDA Base Class:

If you need any additional information, please write.

THANK YOU

UPD:




image

p.s: I removed the line Asset->ClearFlags(RF_Standalone), I believe it is possible without it. :face_with_bags_under_eyes:

Are you testing this in the Editor or in a packaged build?

You shouldn’t have to clear the Standalone flag to make this work. But you also can’t do this sort of testing in the Editor because it does all sort of things to preload and keep loaded certain assets based on what you might be working on. If the only reason it’s still loaded is the Standalone flag, it sounds like you’re doing this in Editor and if that’s the only reason it’s loaded you’re fine. Just don’t clear it as part of your own implementation.

1 Like

Thank you very much, and indeed it was because of testing in the Editor (I couldn’t even think that it was because of this)))).
It’s good that I understood why, but how much time I wasted… eh… okay

Thanks again