[ajug-members] asked a different way
Wilson, Jeff
jw9615 at att.com
Fri Sep 12 08:45:22 EDT 2008
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
More information about the ajug-members
mailing list