Solved

How to get the Object size at runtime ?

Posted on 2009-07-14
5
665 Views
Last Modified: 2012-05-07
We want to find out Object size at runtime
But
Do not want to use Reflection, because it adds performance issue.
Do not want to use the conventional method of calculating an Object by the no. of Primitive data it holds.

Is there any other way, i can get the Object size but that does not add any performance issue.
0
Comment
Question by:manojatinfy
5 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 24847528
There's certainly no overhead-free way of doing it. Just check memory usage via Runtime before and after creation
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 24847545
You can't get the size of the object at runtime in java. You
can only guess, which I don't think you are asking.
0
 
LVL 20

Expert Comment

by:a_b
ID: 24847602
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 24847692
0
 

Author Comment

by:manojatinfy
ID: 24901941
Dear Objects,
While running the sizeOf program, we are getting following error.
Exception in thread "main" java.lang.IllegalStateException: Instrumentation is null
      at net.sourceforge.sizeof.SizeOf.sizeOf(SizeOf.java:59)
Kindly suggest, if there are any inputs required.
Can you please share the Help text to run this program.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
servlet  URL Rewriting 1 42
null output 3 35
by zero exception 10 51
Eclipse for Java EE development 2 25
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question