Changing the color (or perhaps appearance in general) of an atom leaks a small amount of memory. Rapidly changing the color of numerous atoms makes the leaking memory obvious.
Code Snippet (if applicable) to Reproduce Problem:
// This snippet randomizes the color of every turf every decisecond
// The turfs don't have icons, but that doesn't seem to matter
maxx = 50 // Only relevant for how quickly memory is consumed
maxy = 50
. = ..()
T.color = list(rand(), rand(), rand(), rand(), rand(), rand(), rand(), rand(), rand())
// This also works, but seems to slow down before consuming too much memory:
// T.color = rgb(rand(255),rand(255),rand(255))
Memory usage would remain fairly consistent.
- Usually, memory usage climbs at a modest pace (several MB each second), eventually reaching the limit and crashing Dream Daemon.
- Stopping the world may free some of the memory, or may crash DD. Attempting to re-start the world and reconnect usually causes it to hang or crash.
- Sometimes, DD will stop responding to the client shortly after connecting. Attempting to stop it will cause it to hang on "closing world", and attempting to exit will cause it to crash.
When does the problem NOT occur?
When the color var is not modified inside the loop.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
507.1286 seems to exhibit the problem (with RGB instead of a color matrix, of course). 505.1235 would not let me connect at all, and I'm not sure why. I did not attempt to go back further.
I also tested 511.1373, and the problem still exists.
Less frequent changing of colors, and more frequent restarting of Dream Daemon to clear out leaked memory.