[ajug-members] asked a different way

521 521 at ofig.org
Fri Sep 12 10:16:27 EDT 2008


jeff, like this...  attached, i've never used arraylist; neat, not sure there is much memory change

barclay

On Fri, 12 Sep 2008 08:45:22 -0400, Wilson, Jeff wrote
> If I'm reading your program correctly, you aren't actually allocating 
> any objects. The statement: 
> 
> Rational fraction; 
> 
> Allocates only enough memory to hold a reference -- its essentially a 
> pointer, so it probably is on the order of 4 bytes. It doesn't actually 
> allocate an object. 
> 
> Try changing it to: 
> 
> Rational fraction = new Rational(); 
> 
> And see what happens. However, even that is not guaranteed to allocate 
> any memory because the VM can optimize this allocation away since the 
> object is never used. 
> 
> A more interesting test might be to do the following: 
> 
> List<Rational> fractions = new ArrayList<Rational>(); 
> for (int I = 0; i< 100; i++) { 
>  fractions.add(new Rational()); 
>  println(runtime.freeMemory()); 
> } 
> fractions.empty(); 
> println(runtime.freeMemory()); 
> 
> +jeff (MJW) 
> --- 
> 
> "If you are going through hell, keep going." 
> -W. Churchill 
> 
> --------------------------------------------- 
> M. Jeff Wilson, Lead Member Technical Staff 
> AT&T Services, Inc. 
> Operations & Service Dev 
> jw9615 at att.com 
> +1 404.499.7235 
> -----Original Message----- 
> From: mcdaniel [mailto:521 at ofig.org] 
> Sent: Thursday, September 11, 2008 5:45 AM 
> To: Burr Sutter; ajug-members at ajug.org 
> Subject: [ajug-members] asked a different way 
> 
> why does this post/attached not show up on the ajug user/mail group? 
> 
> thanks 
> 
> barclay 
> >>>>>>>>>>>>>> 
> 
> let me ask this then, how can i display the amt of free-memory 
> before/after 10000 Rational objects are allocated, then not saved in a 
> variable- which makes them garbage? per (near how) the *attached* 
> screen-shot (fails to show) 
> 
> barclay 
> 
> barclay 
> 
> ***** 
> 
> The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers. GA623 
> 
> _______________________________________________ 
> ajug-members mailing list 
> ajug-members at ajug.org 
> http://www.ajug.org/mailman/listinfo/ajug-members

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.ajug.org/pipermail/ajug-members/attachments/20080912/fce20671/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WatchMemory2.jpg
Type: application/octet-stream
Size: 103022 bytes
Desc: not available
Url : http://www.ajug.org/pipermail/ajug-members/attachments/20080912/fce20671/attachment-0001.obj 


More information about the ajug-members mailing list