Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2006

Tip: Looking for answers? Try searching our database.

I want to know Size of operator in java like cpp

Thread view: 
Srinu - 25 Sep 2006 07:41 GMT
how do we know how much mewmory allocated to class
Manish Pandit - 25 Sep 2006 08:48 GMT
http://martin.nobilitas.com/java/sizeof.html

http://www.glenmccl.com/tip_038.htm

Hope this helps.

-cheers,
Manish
Hendrik Maryns - 25 Sep 2006 09:00 GMT
Srinu schreef:
> how do we know how much mewmory allocated to class

Google is you friend.
H.
- --
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
http://aouw.org
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
Mark Jeffcoat - 25 Sep 2006 09:07 GMT
> how do we know how much mewmory allocated to class

Java doesn't need a sizeof operator, because it doesn't
have C's platform-dependence in the size of various
types.

Don't try to roll your own profiler. There are plenty
of good ones available, even for free; I'm using JRat
(jrat.sourceforge.net) myself.

Signature

Mark Jeffcoat
Austin, TX

maas - 25 Sep 2006 11:26 GMT
and you just can't rely on the results you get using any 'indirect
approach' (as the freeMemory one, posted above)... the underlying
implementation can change even among different JRE/SDK versions...

but there are some 'rules of the thumb' for using memory wisely:

. byte, short and int are at most as big as an 'int', and a int
occupies at least 4 bytes
. a char occupies at least two bytes
. an object is as big as the sum of its componets
. an array is an object too

and etc.

but there's no way to precisely define the space used by your data
structures, you can not get to know the size of the data structures
maintained by the garbage collector and by the virtual machine...

maas

-
http://www.marcosaurelio.com

> > how do we know how much mewmory allocated to class
>
[quoted text clipped - 5 lines]
> of good ones available, even for free; I'm using JRat
> (jrat.sourceforge.net) myself.
marco.rosi@gmail.com - 22 Oct 2006 13:10 GMT
Srinu ha scritto:

> how do we know how much mewmory allocated to class

try this: http://sourceforge.net/projects/sizeof/
it's based on the "new" java.lang.Instrumentation package
bye


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.