Title: RE: [CFCDev] Objects byReference

I think it comes down to Roland’s original comment: it’s probably a good bet that the JVM’s authors may just be better at determining when to run GC than a schmoe like me.  ;^)

 

As an aside I would also assume that GC is one of those areas where the many JVMs can distinguish themselves: I wouldn’t expect GC to run exactly the same across the Sun, IBM and MS JVMs for example – I would expect each to be tuned slightly differently in that regard and perhaps respond to the system calls slightly differently as well.

 

I’m not sure about that, but it seems like a reasonable assumption.

 

Jim Davis

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hal Helms
Sent: Thursday, January 20, 2005 9:29 AM
To: [email protected]
Subject: RE: [CFCDev] Objects byReference

 

All you can do by calling java.lang.System.gc() is *suggest* to Java that it clean up memory. There’s no way to truly invoke the garbage collector.

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Roland Collins
Sent: Thursday, January 20, 2005 12:03 AM
To: [email protected]
Subject: RE: [CFCDev] Objects byReference

 

Well, you _can_ force GC, but I wouldn’t recommend it except in _extremely_ rare situations.  I’d wager java’s native routines are fairly well tuned at this point, and who knows what CF is doing to optimize GC under the hood.

 

If you _have_ to play with it, you can do this, but don’t hurt yourself (hands over the loaded pistol):

 

<CFSET sys = CreateObject("java", "java.lang.System")>

<CFSET sys.runFinalization()>

<CFSET sys.gc()>

 

Roland

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Wednesday, January 19, 2005 10:54 PM
To: [email protected]
Subject: RE: [CFCDev] Objects byReference

 

 

 

Hehe Barry you had a point? When did you start doing them! hehehehe

> so, this leads to two more questions:
> Q1) when does the GC run - especially for objects in server
> scope? I know in .NET the GC runs on a low-priority thread...

No idea, probably the same as all j2EE applications.
 
> Q2) can you (in CF or java) force an object to be GC'd:
> ie: in VB you can "Set obj = Nothing" to destroy the pointer
> but you can also get rid of it completly with
>   obj.Dispose()
>   System.GC.Collect()

> (yes, I realise the over head of forcing the GC to do it's
> job but there *are* occasions where it's worthwhile)

No, all you're doing there in CFMX is pointing that key at a new value, but the actual object itself still exists downstream. If it were on its own, then yes you do remove the reference from the object..its just a weird way of emptying a variable instead of StructDelete - that's my assumption anyway (I did sound like I knew it was the case then didn't i...sif).

>
> and on the subject of terminology, and we shouldn't be afraid
> of using the "P" word - "pointer"

Don't you start pointing words like pointer at us. Pointer is one of those words where when I hear it think of "Floating pointer" for some reason - which confuses me further - so I like the ye-olde "reference" - I think it serves the naming well?

Scott

Reply via email to