[V4RB] should i kill this VCursor? [was, 3 simple [?] questions]

Ruslan Zasukhin sunshine at public.kherson.ua
Tue Mar 4 23:54:24 CST 2003


on 3/4/03 11:17 PM, Pedro fp at lists at pedro.net.au wrote:

Hi Pedro,

> G'day Folks
> 
> I'm still breaking out of the REALdb way of doing things & just
> realised that the VCursor that I have had as a property of a class
> could be a sub-class of VCursor. If i keep the general mechanism the
> same thne when imprting files of data that VCursor could be
> re-instantiated repeatedly in a loop. Should I explicitly kill the
> VCursor before the next statement like this?
> 
>  for ...
>    cur = new myVCursor( dbName, SQLstring )
>    ... ' see my next question
>    cur = nil
>  next
> 
> or is this OK?
> 
>  for ...
>    cur = new myVCursor( dbName, SQLstring )
>    ... ' see my next question
>  next

Both way will work correctly,
But first way is recommended.

Because, in first way you at point curs = nil,
Explicitly FREE RAM used by this cursor.

In second case, this will do for you REALbasic's garbage collection,
And as far as I have see, for both, RB and Java, they at first create NEW
SECOND cursor and only later call destructor for first cursor.

This means that if first cursor use 4MB of RAM, and second use 5MB, you get
moment when they both eat 9MB.

In first way, you get maximum 4MB and 5MB usage of RAM.
This is GOOOOD :-)

> Am I correct in thinking that it'd be OK to give the constructor of a
> sub-class of VCursor additional parameters?

This is second question ?  :-)

First of all, please carefully test if all this works.
I mean sub classing. In RB 3.0 or so. This was broken.
from MyCursor constructor we couldn't call VCursor constructor.

May be now RB have this fixed.

> If so I could move the code that follows creation of the cursor into the
> cursor which I think would be an improvement for this project [if not others
> as well].

I am not sure what you talk about here...
Try it and see if it works :-)

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://listserv.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list