Solved

How to get the Object size at runtime ?

Posted on 2009-07-14
5
666 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
use lov values 2 71
jsp insert to database example 2 59
java mysql insert application 14 43
IBM TS2900 (3572) Tape Autoloader Java? 12 58
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
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 …

756 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