minetest / minetest

Minetest is an open source voxel game-creation platform with easy modding and game creation
https://www.minetest.net/
Other
10.58k stars 1.99k forks source link

Drop texture-modifier-generated textures from memory after a timeout #14884

Closed MisterE123 closed 3 weeks ago

MisterE123 commented 1 month ago

Problem

Related: https://github.com/minetest/minetest/issues/3528#issuecomment-2252796632

I need a way to continuously update a complex HUD that is based on texture modifiers without creating a memory leak.

The problem is that all texture modifiers are saved as a new media file in client memory. When I build an image using texture modifiers from parts that the client already has, and then set the HUD to that image every globalstep, the client's ram fills up.

Solutions

Suggested by @celeron55: Let clients drop texture-modifier-generated textures from memory after they have not been used for a while, since the client can always re-generate them from the texture-modifier-name string if needed.

Alternatives

An alternative would be to have a way to drop any media as suggested in #3528, but celeron55 thinks his suggestion is simpler and more achieveable

Additional context

IRC discussion: https://irc.minetest.net/minetest-dev/2024-07-26#i_6187630

My minimap, the texture modifier string of which is sent every global step or, at this point, every second: image

appgurueu commented 1 month ago

Effectively a duplicate (or perhaps more specifically "sub-issue") of #11531, with the specific suggestion of a timeout (which is probably necessary to avoid unnecessarily regenerating textures excessively often in some case)? See specifically https://github.com/minetest/minetest/issues/11531#issuecomment-897226253, which should already cover this.

MisterE123 commented 1 month ago

I mean, it seems you are not wrong that it is a duplicate, but I think the name of my issue is clearer from a modder's gripe perspective

MisterE123 commented 1 month ago

@appgurueu Warr suggested we ask you: could you fix this issue?

Here is a cat: 🐱