When you put an icon in a grid using either the \icon macro or the <img> tag with the \ref macro, Dream Seeker allocates memory for the entire icon, even if you only wanted a specific state. Not only that, but if you ask again for the exact same icon and icon_state combo, it allocates all that memory again, and it never frees the memory! That leads to obscene amounts of memory usage. (Which can lead to crashes from lack of memory.)
Numbered Steps to Reproduce Problem:
- Make a grid in your interface file.
- Set the cells property to a large number of cells. (e.g. 500)
- Get an icon that is large, but has small individual icon states. ('Large' can be about 3KB.)
- Use output() to send a particular icon state from the icon to the grid in different cells.
- Use either \icon or <img> with \ref to show the image.
- Just repeat this until many different cells all have the same image.
Here is a demo that shows the bug in action.
Code Snippet (if applicable) to Reproduce Problem:
It should only allocate enough memory to show the one chosen icon_state.
It should only allocate memory for the entire icon one time and reuse the icon in memory.
When putting an image in the grid using the \ref macro, it allocates new memory
for the entire icon without freeing that memory every time.
Does the problem occur:
Every time? Or how often? Always.
In other games? Yes.
In other user accounts? Yes.
On other computers? I do not know.
When does the problem NOT occur?
If you have a small icon, then it only allocates memory for that icon each time, which can save memory allocation, but that's not a fix.
It always occurs as long as the icon is big enough.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked?
I'm not sure, but I'll assume it's been here for a while.
I don't know of any workarounds that completely eliminate the problem.
I'll try to find one.
A possible workaround is to get the icon downloaded from a website, instead of from within the game itself. (By using the enable-http-images property.) A nice solution would be the ability to get images from the user's cache (sent with browse_rsc) with this method.