Why are stack references not counted?

BlitzMax Forums/BlitzMax Programming/Why are stack references not counted?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hi!

A BlitzMax object's reference counter only counts Global and Field variables pointing to the object. Local variables aren't counted; when the GC gets called there's a loop running over the stack and counting the Locals.

Why is it done this way?
I guess it's for speed optimizing? or what is it for?
Or is there any other advantage because it's done like it is?

And as my second question: would you change this behaviour if we could have this features if all references were counted:
- multithreading (could really be possible in BMX!)
- Object Ptr not confusing the GC
- a method returning the refcount