[Repro] Unable to unload texture dict

Server

Operating system: Windows
Resources: Default resources and one custom for the repro (shared bellow)
Player needed : Yourself is enough :upside_down_face:

Incident

The SetStreamedTextureDictAsNoLongerNeeded doesn’t do the job, the streamed texture will stay forever in the memory.

[Script] https://github.com/CookayGaming/reprotexture
[Video] https://streamable.com/lhq59h

  1. As you can see, the first time starting the resource will load the texture (being visible in strmem).
  2. As expected the texture dict isn’t loaded so the script will request it.
  3. The sprite is displayed and everything seems good.
  4. After the 2sc timer we stop displaying the sprite and we call SetStreamedTextureDictAsNoLongerNeeded.
  5. You can clearly see that the dict is still in the memory (strmem menu)
  6. I restart the script, when it goes in the : HasStreamedTextureDictLoaded it return true, that means it isn’t a visual problem, texture is still loaded.

Another thing, if you disconnect from the server but don’t quit the game and the reconnect the texture will still be in the memory, so even disconnecting doesn’t correctly unload the texture.

Repro

  1. Connect on your server (even vanilla)
  2. While being connected, start the reprotexture resource
  3. Wait 2-3sc, you should see the sprite on your screen for 2 sc and then it should disappear
  4. Open strmem 1 and see that the texture dict is still loaded.
  5. Restart the resource to see the HasStreamedTextureDictLoaded returning false, confirming that the texture dict is still loaded.

Not sure how this is a bug? ‘mark as no longer needed’ does not ‘unload’ stuff instantly, it just sets it as able to be unloaded when the game needs to do memory cleanup.

Might be a game oversight by R* however if HAS_STREAMED_TEXTURE_DICT_LOADED returns true while a script marked it as not-needed, especially as R* seemingly intended for it to check script ownership given a stray call to get a script handler instance (likely a debug assertion?).

Oh, ok, then there is no way to instantly unload it, i see, i hope it eventually unload it if memory usage is saturated, thanks for the answer then!