But you cant actually say that this is the size of the object from calling
freememory before and after object creation..

On Wed, Nov 25, 2009 at 5:15 PM, Phani Kumar <gsphaniku...@gmail.com> wrote:

> java.lang.Runtime class has a method* freeMemory 
> <http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html#freeMemory%28%29>()*
>  which returns the amount of free memory
>
>
>
> in the JVM. You can call this method before creating an object and after 
> creating an object.
>
>
> On Wed, Nov 25, 2009 at 4:04 PM, daizi sheng <daizish...@gmail.com> wrote:
>
>> java normally pre-alloc much memory and so you have no way to get the
>> actual heap usage with simple method.
>> normally for a given jvm, the size of an object can be calculated
>> statically.
>> what you need is to read source code of jvm, :)
>>
>> anyway, you can simple estimate size of an object as the summation of
>> its properties, plus some additional header fields.
>> NOTE that reference only occupy a pointer size unit. This is quite
>> different from c++.
>>
>> On Wed, Nov 25, 2009 at 5:20 PM, Abhijeet Kumar
>> <abhijeet.k.s...@gmail.com> wrote:
>> >
>> > how do i measure the JVM memory ???
>> > can u specify a command or class to use??
>> >
>> > On Wed, Nov 25, 2009 at 8:12 AM, Chakravarthi Muppalla <
>> chakri...@gmail.com>
>> > wrote:
>> >>
>> >> measure jvm memory usage before/after creating ur object; but it is not
>> >> assured to give the correct size(gc).
>> >> or u can use a premain agent.
>> >>
>> >> On Wed, Nov 25, 2009 at 12:37 AM, Abhijeet Kumar
>> >> <abhijeet.k.s...@gmail.com> wrote:
>> >>>
>> >>> How can i find size of an object in java????
>> >>> plsss answer asap
>> >>>
>> >>> --
>> >>>
>> >>> You received this message because you are subscribed to the Google
>> Groups
>> >>> "Algorithm Geeks" group.
>> >>> To post to this group, send email to algoge...@googlegroups.com.
>> >>> To unsubscribe from this group, send email to
>> >>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>> .
>> >>> For more options, visit this group at
>> >>> http://groups.google.com/group/algogeeks?hl=en.
>> >>
>> >>
>> >>
>> >> --
>> >> Thanks,
>> >> Chakravarthi.
>> >>
>> >> --
>> >>
>> >> You received this message because you are subscribed to the Google
>> Groups
>> >> "Algorithm Geeks" group.
>> >> To post to this group, send email to algoge...@googlegroups.com.
>> >> To unsubscribe from this group, send email to
>> >> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>> .
>> >> For more options, visit this group at
>> >> http://groups.google.com/group/algogeeks?hl=en.
>> >
>> >
>> >
>> > --
>> > Cheers..
>> > Abhijeet Kumar
>> >
>> > --
>> >
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "Algorithm Geeks" group.
>> > To post to this group, send email to algoge...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>> .
>> > For more options, visit this group at
>> > http://groups.google.com/group/algogeeks?hl=en.
>> >
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>>
>
>
> --
> Thanks
> Phani
> http://www.phanikumar.com/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Luv,
S.Antony Vincent Pandian

--

You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.


Reply via email to