You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi
I am doing the following
long totalMemory = Runtime.getRuntime().totalMemory();
MyObject = createMyObject(args);
memoryGuessed = Runtime.getRuntime().totalMemory() - totalMemory;
Footprint footprint = ObjectGraphMeasurer.measure(appSession);
log.info("footprint.toString()
+ " memory:" + MemoryMeasurer.measureBytes(appSession)
+ " memoryGuessed:" + memoryGuessed
);
And the result is
footprint:Footprint{Objects=70992, References=194939, Primitives=[int x 63043,
long x 452, char x 437906, byte x 78594, boolean x 12100, float x 2331]}
memory:2821976 memoryGuessed:327680
I am using:
Ubuntu 12.04.2 LTS, Precise Pangolin
Linux ubuntu 3.2.0-43-generic-pae #68-Ubuntu SMP Wed May 15 03:55:10 UTC 2013
i686 i686 i386 GNU/Linux
Why is memory x8 greater than memoryGuessed? Could it be that memory is bits
and not bytes? Am I missing something? Thank you for your help!
Original issue reported on code.google.com by [email protected] on 23 May 2013 at 6:56
The text was updated successfully, but these errors were encountered:
(Assuming the second line is "MyObject appSession = ...")
Perhaps appSession points to objects that existed before the instantiation of
that. Are you sure that you constructed everything beneath it, after measuring
totalMemory()?
Anyway, to validate the computation, you can always use
ObjectExplorer.exploreObject(appSession, new ObjectVisitor<Void>() {
public Traversal visit(Chain chain) {
println(chain);
return Traversal.EXPLORE;
}
..
});
Though this will probably print a lot of paths.
And to make sure it avoids cycles, you'd probably try something this instead:
final Predicate<Chain> atMostOnce = new ObjectExplorer.AtMostOncePredicate();
ObjectExplorer.exploreObject(appSession, new ObjectVisitor<Void>() {
public Traversal visit(Chain chain) {
println(chain);
return atMostOnce.apply(chain) ? Traversal.EXPLORE : Traversal.SKIP;
}
..
});
The library is a bit raw, I know, sorry about that
Original comment by jim.andreou on 26 May 2013 at 3:48
Original issue reported on code.google.com by
[email protected]
on 23 May 2013 at 6:56The text was updated successfully, but these errors were encountered: