ID:1937349
 
Resolved
Creating images with new() caused a memory leak.
BYOND Version:508
Operating System:Windows 7 Pro 64-bit
Web Browser:Chrome 45.0.2454.93
Applies to:Dream Daemon
Status: Resolved (509.1300)

This issue has been resolved.
Descriptive Problem Summary: So I've been racking my brain for a while now trying to trace the source of a memory leak having to do with lists. I've seemed to narrow down the cause to image objects. List memory rises with each new image created and doesn't seem to return to normal. When objects are used to achieve the same effect, there is no issue with memory.

Something odd, though, is I checked if images were in fact deleting by overriding image/Del(), and I got the correct response.

Numbered Steps to Reproduce Problem: See the code snippet; use it and you should be able to reproduce the issue effectively.

Code Snippet (if applicable) to Reproduce Problem:
mob/verb/testverb()
//stun_maptext(loc, src)
//enter_melee_mode_maptext(loc, src)

var fade_time = 10
//var obj/o = shadowed_maptext(span("combat_maptext", "Entered Melee Mode"), "#f00")
var image/someimg = new(loc = src.loc, pixel_x = -4 + src.step_x, pixel_y = 16 + src.step_y)
//var obj/someimg = new(loc)
//someimg.appearance = o.appearance
someimg.maptext = "Entered Melee Mode"
someimg.maptext_width = 160
someimg.maptext_height = 160
src << someimg
animate(someimg, pixel_y = someimg.pixel_y + 32, alpha = 0, time = fade_time)
spawn(fade_time)
client.images -= someimg
someimg.loc = null


Expected Results: For image objects not to increase list memory, or at least free it when no longer used.

Actual Results: List memory rises and never returns to normal.

Does the problem occur:
Every time? Or how often? Every time.
In other games? All games; I reproduced it in a test project with the above snippet.
In other user accounts? N/A
On other computers? N/A

When does the problem NOT occur? When I don't use images.

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.)
I first discovered it using 508.1299, and reproduced it reliably in 508.1292.

Workarounds: Don't use images. This isn't feasible for me however.

http://www.byond.com/download/build/506/506.1250_byond.zip

Do you mind trying it on this version and let me know if this occures. Please and thank you!
Can you clarify what you mean by "list memory"? Are you referring to memory in general, or the report from DD's memory stats?

[edit]
Never mind; I see that the memory stats do indeed show this in the list memory.
Lummox JR resolved issue with message:
Creating images with new() caused a memory leak.
Can this be the issue I've been having with 507-8 version where tabs that have Icons or numbers that update in em stutter and does huge CPU usage?
No, Zasif. It's very clearly unrelated. But I'd be happy to look into your issue if you'd provide a demo for it.
My demo woudnt work, as I have a feeling it only works on as a hosted game.
In response to Zasif
You can always confirm that by hosting your demo in Dream Daemon and joining locally in Dream Seeker. If that doesn't work, then either 1) the demo doesn't actually show the issue, or 2) the right kind of activity isn't happening. At any rate, I need a lot more to go on than just that icons and numbers are updating.
Appreciate it. Looking forward to trying out 509.