ID:1224959
 
Resolved
The bounds() and obounds() procs had a refcount leak.
BYOND Version:498
Operating System:Windows Vista Home Premium 64-bit
Web Browser:Chrome 27.0.1453.9
Applies to:Dream Daemon
Status: Resolved (499.1194)

This issue has been resolved.
Descriptive Problem Summary:
Looping through obounds, and deleting the items in it causes refcount errors.
I've tested this with obounds as well.
DarkCampainger says no errors occur if you use range, view, etc.

I don't really have much information about the bug, but Lummox JR told me to post a bug report.

Numbered Steps to Reproduce Problem:
1. Run project (linked in the next section)
2. Turn on Dream Seeker's debug mode. ".configure debug on" in the Command prompt. I don't think the errors display in Dream Seeker otherwise, not entirely sure.
3. Click somewhere to spawn a big blue ball,
4. Wait for a red ball to collide with a blue ball.
5. Wait for refcount errors to appear. They should appear when the collision happens, and when the blue ball "expires".
6. Ref count errors appear at line 68 and 86.
Code Snippet (if applicable) to Reproduce Problem:
I've uploaded a project where this happens here. This is an older version of the game currently found at SuperSaiyanx.Balls, it doesn't share much of the same code now.
Code surrounding line 85:
    makeBig(Small/c)
var //I assign the values of the variables from c to new variables, as to not keep a reference to c in Big's New()
sx = c.step_x
sy = c.step_y
loc = c.loc
del c
new /Big (loc, sx, sy)
// makeBig is called by:
Small
Move(NewLoc)
spawn(2)
for(var/Big/c in obounds(src))
if(inCircle(c, src))
makeBig(src)
sleep(5)

Code surrounding line 68:
Big
New(loc, sx, sy)

step_x -= 0.5*(bound_width) - sx
step_y -= 0.5*(bound_height) - sy

for(var/Small/x in obounds(src))
makeBig(x)
sleep(5)
spawn(50)
del src


Expected Results:
No errors, deletes without any kind of output.
Actual Results:
Refcount errors, deletes fine aside from that.

The refcount=x fluctuates, for line 85.
BUG: Finished erasure with refcount=229 (ref=2:18) DM (Balls of Reaction.dm:85)

All errors on line 68 are refcount=1 (I'm assuming the reference is the paramater for obounds)
BUG: Finished erasure with refcount=1 (ref=2:6) DM (Balls of Reaction.dm:68)

Does the problem occur:
Every time? Or how often? Every time a red ball hits a blue ball.
In other games? No idea.
In other user accounts? Yes.
On other computers? Yes.

When does the problem NOT occur?
If you use view, oview, and so on it doesn't occur.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked?
It's happened for a long while, ever since obounds was introduced, I guess.

Workarounds:
set loc to null, rather than delete.
Has this ever led to a total freeze up for you? I'm having the same errors, and after a while my server spontaneously freezes.
I've never had any freeze ups with this example...

What is the ref in your errors?
Look at the text in parentheses:
BUG: Finished erasure with refcount=1 (ref=2:6) DM (Balls of Reaction.dm:68)

Is the ref=2, or is it ref=5?
5 is clients, which has been reported before with no consistently reproducible case, I think.
http://www.byond.com/members/ChrisGayle/files/2013-04/ ChrisGayle-0001/errors.png

Seems be mostly (ref=2:xxx), I've also found some (ref=3:xxx)
If you're hosting via DD - enable DEBUG mode (#define DEBUG) or through one of the menus in Dream Maker. should show you line numbers, so you can follow the errors next time they happen.

If you're just in singleplayer/local through DS, follow the Dream Seeker debug mode instructions above & enable DEBUG mode in Dream Maker.
https://www.dropbox.com/s/eeiymt0814o274q/ Spirit%20Age_log.log
Just decided to share the entire log of these ref errors, still having the same problem and haven't found any sufficient solution.
Have you compiled in debug mode? It should show file & line numbers at which the errors occur.

You'd be able to see where the error occurs, and see if it's related to obounds/bounds.

Lummox JR resolved issue with message:
The bounds() and obounds() procs had a refcount leak.