Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to get the Object size at runtime ?

Posted on 2009-07-14
5
Medium Priority
?
673 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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 …
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

722 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