[Openroad-users] Question about the value and useof.InstanceReferences

Peter van Bennekom Peter.vanBennekom at infor.com
Thu Nov 15 08:37:46 EST 2007


Bodo,

 

My code only holds one reference - the fact that there is a system
variable called curObject does not constitute a reference increase -
besides it is in the object itself - I do not expect a reference
increase inside of itself (including subclasses)...

 

It would be nice to know if this attribute is used by anyone else in
what way.

 

 

Oops

METHOD showIR() =

Begin

          Curmethod.trace( text = 'showIR: ' + varchar(
curObject.InstanceReferences ) );

          curObject.showMore();

End;

 

 

Peter van Bennekom | Sr. Principal Architect | Infor | office:
610-407-8113 | fax: 610-407-8027 | mailto:peter.vanbennekom at infor.com

________________________________

From: openroad-users-bounces at peerlessit.com
[mailto:openroad-users-bounces at peerlessit.com] On Behalf Of Bodo
Bergmann
Sent: Wednesday, November 14, 2007 4:19 PM
To: International OpenROAD Users
Subject: Re: [Openroad-users] Question about the value and
useof.InstanceReferences

 

Peter,

 

why do you think that the reference count should be 1 ?

There are (at least) 2 references to the object when you are within your
showIR() method:

1.	the one from your variable ir_object in the calling procedure
ir_test
2.	CurObject system variable in the method scope points to the same
object

So, IMO the output is correct.

 

BTW:

The output and the source you provided don't match:

There is no invocation of ShowMore(), but there is an output for it.

 

Regards,

Bodo.

 

Bodo Bergmann

Senior Software Engineer

OpenROAD Worldwide Development

Ingres Corp.

 

 

________________________________

From: openroad-users-bounces at peerlessit.com
[mailto:openroad-users-bounces at peerlessit.com] On Behalf Of Peter van
Bennekom
Sent: Wednesday, November 14, 2007 8:51 AM
To: International OpenROAD Users
Subject: [Openroad-users] Question about the value and use
of.InstanceReferences

Folks,

 

I have noticed that this attribute reflects the number of instances
pointing to this object at runtime - not only does it hold the number of
references in the code but it also reflects when OpenROAD points to it.
Example:

 

PROCEDURE ir_test() =

Declare

          ir_object = ir_class;

EndDeclare

Begin

          Curprocedure.trace( text = 'proc before call: ' + varchar(
ir_object.InstanceReferences ) );

          Ir_object.showIR();

          Curprocedure.trace( text = 'proc after call: ' + varchar(
ir_object.InstanceReferences ) );

End;

 

Ir_class is userclass with two methods:

METHOD showIR() =

Begin

          Curmethod.trace( text = 'showIR: ' + varchar(
curObject.InstanceReferences ) );

End;

 

METHOD showMore() =

Begin

          Curmethod.trace( text = 'showMore: ' + varchar(
curObject.InstanceReferences ) );

End;

 

Output is as follows:

proc before call: 1

showIR: 2

showMore: 3

proc after call: 1

 

One can argue about the value of this kind of increment and decrement.
If one would like to implement a concept of freeing memory when object
is not needed anymore (circular references i.e. but also NULLing pointer
from self - we have found that sometimes when you do not null pointers
when not needed anymore memory is still claimed) based on the
instanceReferences attribute one would find out this is impossible.  One
would like to see how many references the code has (1 in this little
example) so implementing above mentioned concept can be done.

 

My questions to the group are: are you using this attribute, if so: how
are you using it and do you have to jump through hoops to get what you
want?  If you are consciously not using it what kept you from using it?

 

Thanks,

Peter

Peter van Bennekom | Sr. Principal Architect | Infor | office:
610-407-8113 | fax: 610-407-8027 | mailto:peter.vanbennekom at infor.com

  <http://www.infor.com/> 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.peerlessit.com/pipermail/openroad-users/attachments/20071114/114ca901/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 2926 bytes
Desc: image001.gif
Url : http://www.peerlessit.com/pipermail/openroad-users/attachments/20071114/114ca901/attachment.gif 


More information about the Openroad-users mailing list