Solved

How to get the Object size at runtime ?

Posted on 2009-07-14
5
667 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

739 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