Sean is correct, this is known as a "reference count" (or refcount
for short). It is a count of the number of different variables that
maintain a reference to the same object. For example, if you execute:
MyObjectReference = new(script "Sprite Group Parent") -- the
refcount becomes 1.
If you then execute:
someOtherVariable = MyObjectReference -- the refcount is now 2
Whenever the refcount goes to zero, the Director memory manager knows
that there are no more variables that refer to this object and the
memory manager "garbage collects" the memory allocated for the
object. You lower the refcount by assigning a different value into
variables that hold references to objects:
someOtherVariable = VOID -- now the refcount is lowered to 1
MyObjectReference = VOID -- now the refcount becomes 0 and
Director can safely get rid of the memory used by the Sprite Group
Parent
One other thing to mention. If you do a "put" on an object reference
variable, since "put" is really a call to Director, it temporarily
(during the call) increments the refcount, and decrements the
refcount when the "put" is done. So, if you just create an object,
then do a "put" on the resulting object reference variable, the
refcount will be two.
Irv
At 1:41 PM +1200 9/13/01, Sean Wilson wrote:
> > When I see an object reference such as:
>>
>> <offspring "Sprite Group Parent"15 3765f98>
>>
>> what do the numbers signify? I surmise the 3765f98 is the RAM address of
>> the object. How about the 15? Does that mean it's the 15th object created?
>
>As i understand it, the 15 is the number of references/pointers to this
>object being stored somewhere it your program.
>
>I stand to be corrected on that, though.
>
>-Sean.
>
--
Lingo / Director / Shockwave development for all occasions.
(Home-made Lingo cooked up fresh every day just for you.)
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]