ID:1995975
 
Not a bug
BYOND Version:509
Operating System:Windows 10 Pro 64-bit
Web Browser:Firefox 42.0
Applies to:Dream Seeker
Status: Not a bug

This is not a bug. It may be an incorrect use of syntax or a limitation in the software. For further discussion on the matter, please consult the BYOND forums.
Descriptive Problem Summary:

When applying a color modification to an icon with icon+=[rgb] a temporary version of that icon is created with the color modification applied.

These icons seem to never want to go away and hang around in your RAM until DS closes.

Numbered Steps to Reproduce Problem:

use any icon

run an operation like so: icon+=rgb(rand(0,255),rand(0,255),(rand(0,255))

call this operation as fast as possible, watch as RAM usage for DS builds up.

Code Snippet (if applicable) to Reproduce Problem:
mob
verb
kill_ram()
while(src)
sleep(world.tick_lag)
icon=initial(icon) //refresh the icon, otherwise it will become white and no new permutations will exist.
icon+=rgb(rand(0,255),rand(0,255),(rand(0,255))


Expected Results:

After the atom using this icon is deleted, so is this icon.

Actual Results:

it hangs out in RAM and has a party with all it's friends.


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.)

Unsure, I've never had to do this many operations of this type before.

Workarounds:

None so far. I'm unaware if you're able to delete the icon directly. I've attempted to call del(icon) but it does nothing.
The icons will go away, but they have to be removed by a garbage collection cycle. DS will not free the icons immediately, but it will free them eventually.

Screwing with the garbage collection cycle has proven extremely problematic in the past. An attempt to deal with a related problem caused havoc during the 508 cycle.

Note that the best option for adding color to an icon is, as of 509, a simple color matrix.

color = list(null,null,null,null,rgb(rand(0,255),rand(0,255),rand(0,255)))

You'll still see some memory growth from the abundance of new appearances, but it won't be as severe. Those too get deleted in a garbage collection cycle. This is also way nicer to the server.
Lummox JR resolved issue (Not a bug)
In response to Lummox JR
The issue I'm having is that using the icon+rgb is the only way to modify the colors *additively*.

The color variable and matrices seem to operate multiplicatively.

As far as I can tell there's no way to get this effect:



Note: The alpha isn't changing, it's fading from black to gray to white.

In response to Lummox JR
Also:

The icons will go away, but they have to be removed by a garbage collection cycle. DS will not free the icons immediately, but it will free them eventually.

How long is eventually? I let it sit for several minutes and nothing happened. Surely it'd make sense for them to go away if they haven't been used for a few seconds?
In response to Bravo1
Bravo1 wrote:
The issue I'm having is that using the icon+rgb is the only way to modify the colors *additively*.

The color variable and matrices seem to operate multiplicatively.

Matrices do both. The matrix I showed you uses your rgb() as a fifth row, which is a constant row added to the result.

A simple non-matrix color would be multiplicative only.
In response to Bravo1
Bravo1 wrote:
How long is eventually? I let it sit for several minutes and nothing happened. Surely it'd make sense for them to go away if they haven't been used for a few seconds?

A few seconds isn't enough time. The garbage collector fires at least every 5 minutes, sometimes more if enough new icons or appearances have appeared. However all appearance and icons must have been out of use for a certain period of time before they get recycled. Messing with that timing has caused major problems for some games.
Every 5 minutes?

Wut, is there like, a seperate GC for non-datums? My mobs all GC in seconds.
In response to Lummox JR
Lummox JR wrote:
Bravo1 wrote:
The issue I'm having is that using the icon+rgb is the only way to modify the colors *additively*.

The color variable and matrices seem to operate multiplicatively.

Matrices do both. The matrix I showed you uses your rgb() as a fifth row, which is a constant row added to the result.

A simple non-matrix color would be multiplicative only.


I was thrown off by your code example, it's actually bit messed up.

This seems to work:

list(null, null, null, null, rgb())

Thanks. I'll avoid using icon+=rgb() in the future


Ah, you're right, I made a pretty bad copy/paste error in my example.