Calculate Object size in memory

I have some requirement like for testing i want to find out the MEMORY used by jsp sessions.My sessions contain three objects.So how can i find out the memory sixe these objects will consume..
thanks
manoj

the certain size of an object depends on the implementation of the jvm and may vary between different versions.
if you want to estimate the size of an object in memory sum the sizes of all fields and the fields of its superclasses together and if the object has objects as fields add the sizes of their fields too and dont forget the sizes of all fields in the subclasses.
additionally there is an overhead you carry inwith each object (for vtable, runtimetype and other internal stuff), additionally the fields might be padded in memory to that 1 byte would comsume 4 bytes in memory instead 1.
if you want to estimate the size of a certain object call System.gc(), look for freeMemory(), then allocate allocate a huge array of the certain object, then call System.gc() again and see the difference of what is returned by Runtime.getRuntime().freeMemory().

Similar Messages

  • Howto determine Object size in memory?

    HI there!
    I know the JVM has a function which prints out a list of all obejcts currently instantiated with the object size and the number how many objects of this type are alive, but I dont know anymore howto enable this feature.
    My Profiler does not show this information :-(
    Any ideas?
    Thanks in advance, lgClemens

    Read in another thread that you coudl do like this:
      public static long calculateMemoryUsage(ObjectFactory factory) {
        System.gc(); System.gc(); System.gc(); System.gc();
        System.gc(); System.gc(); System.gc(); System.gc();
        System.gc(); System.gc(); System.gc(); System.gc();
        System.gc(); System.gc(); System.gc(); System.gc();
        long mem0 = Runtime.getRuntime().totalMemory() -
          Runtime.getRuntime().freeMemory();
        Object handle = factory.makeObject();
        System.gc(); System.gc(); System.gc(); System.gc();
        System.gc(); System.gc(); System.gc(); System.gc();
        System.gc(); System.gc(); System.gc(); System.gc();
        System.gc(); System.gc(); System.gc(); System.gc();
        long mem1 = Runtime.getRuntime().totalMemory() -
          Runtime.getRuntime().freeMemory();
        return mem1 - mem0;
    public interface ObjectFactory {
      public Object makeObject();
    }Gil

  • How to calculate the size of the heap memory? its urgent pls

    i had a task in which i need to calculate the size of the heap memory can anybody help me its urgent pls

    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html
    Specifically:
    max/total/freeMemory()
    http://javaalmanac.com/egs/java.lang/GetHeapSize.html?l=new

  • Got "java.lang.OutOfMemoryError: allocLargeObjectOrArray - Object size" Err

    System :jrockit-R27.4.0-jdk1.5.0_12
    4 GB RAM
    3GB Switch
    JVM Setting:
    <java classname="com.nomis.documentmgmt.scenario.OptBuildBaselineScript" fork="yes" failonerror="true" maxmemory="1536m">
    <jvmarg value="-client"/>
    <jvmarg value="-Djava.library.path=${dist.dir}/auxiliary/lib"/>
         <!--jvmarg value="-Xms128m"/-->
    <jvmarg value="-Xms1536m"/>
    <jvmarg value="–Xmx1536m"/>
    <jvmarg value="-XXcompactratio=100"/>
    <jvmarg value="-Xgc:genpar"/>
    <jvmarg value="-Xns:96m"/>
    <jvmarg value="-XXlargeObjectLimit:8192"/>
    <jvmarg value="-XXtlasize:16384"/>
    <jvmarg value="-XXgctrigger=5"/>
    Got Below error message
    [java] Exception in thread "Main Thread" java.lang.OutOfMemoryError: allocLargeObjectOrArray - Object size: 1333880, Num elements: 333465

    Looks like you are running out of memory allocating a large array.
    -- Henrik

  • To Calculate the Size of Infocube

    Hi ..
       How to calculate the size of the Infocube...?
    I know there is one formula for it...!
    Can any one help me...
    Thanx in Advance...
    Vasu

    hi Vasu,
    calcute the size of infocube
    - total records
    transaction se16 -> fact table name, /bic/f[infocube name] and /bic/e[infocube name] or /bi0/f.. and /bi0/e for business content infocube, click 'number of entries'
    use program (se38) SAP_INFOCUBE_DESIGNS
    - size in bytes
    transaction db02 -> 'detail analysis' -> object name = [infocube name]
    hope this helps.

  • Is it right to mix sizes of memory modules in a mac mini 2012? for example 2Gb 8Gb?

    Is it right to mix sizes of memory modules in a mac mini 2012? for example 2Gb 8Gb?

    Welcome to the Apple Support Communities
    You can do that without any problem, always that the total amount of memory is less than the maximum memory your Mac mini supports. A Late 2012 Mac mini supports 16 GB of memory, and you can find in this site the steps to install more memory > http://support.apple.com/kb/HT4432?viewlocale=en_US&locale=en_US#1

  • How to calculate the size of web forms in hyperion planning?

    Hi Experts,
    I am trying to calculate the size of planning forms in Hyperion smart view., but i am unable to find out the way to calculate.
    Can you pls explain how to calculate the size of web form in Smart view?
    --- Srini.

    Hi Srini,
    First, here is what Oracle says:
    Data Form Size Estimation:
    To get a rough estimate of data form size, open the data form and select File > Save As from the browser. The size of the .HTML file is the portion of the data form that changes based on grid size. The .JS files remain the same size and can be cached, depending on browser settings. Information such as data form definitions, pages, and .gif files are not compressed when data forms are opened and sent to the Web browser.
    I have not been able to find out using their method.
    In any case, you can find out the size of grid by using below
    1. Right click on the form grid and click "View source"
    2. Save the source file as "Example.html"
    3. Right click the saved file and click "Properties"
    4. The Form size whould be same as that of file..
    Let me know if it helps.
    Cheers
    RS

  • How to redefine the used size of memory for the OC4J of the JDeveloper

    Hi!!!
    I am developing a project that works with net (Route), when I I execute the application of the error because the bank that it loads demands more free memory of the OC4J, somebody knows as I I configure a bigger size of memory for the OC4J in the JDveloper?
    thanks...

    Try setting these parameters under project properties -> Run/Debug configuration -> Java options

  • To calculate the size of backup for a particular database in RMAN catalog

    Hi ALL,
    Could you please guide me how I can calculate the size of backup data for a particular database in Recovery Catalog, if I am using Tapes as my backup media for recovery catalog.
    Regards
    Harpreet Singh

    Hi,
    I am not Up to the mark of your question ..
    If you see the V$log you can get it.. Size of the redo logs can be determined either by examining the file system size or by reading the BYTES column on the V$LOG view. Then Check the number of redo Logs avaialble checked whether they are mirrored or etc., Combining the two figures we have a total redo log data at peak in one day. This is the amount of data that any backup facility or storage of Archive Redo Logs would have to take into account. This figure should be mitigated against the fact that manual switching of redo logs means that not all archived redo logs will be the full size.
    - Pavan Kumar N

  • Get Info versus Calculate All Sizes

    When I go to Finder > View Options and set Calculate All Sizes to "on" for all windows, the GB Free is posted under the hard drive icon (e.g. 94.04 GB, 24.45 GB free). If that value changes for any reason (download of files, whatever), it doesn't immediately update the values under the icon. If I do a Get Info, however, it has updated immediately.
    Is there a way to force Get Info and Calculate to remain in synchronization?
    PowerBook G4 17"   Mac OS X (10.4.4)  

    leonieDF wrote:
    The option to show the info has been moved to the "View Options".  Open your drive in the Finder in Grid View and then select "VIew-> Show View Options". Check the Button
    "Show Item Info".
    That should do the trick.
    Leonie
    that option does not display the HD sizes so its useless when copying between drives, no way to determing how much space is left with out loking for a new window which is backwards,
    i dont see anything cool about lion, maybe if i just got my first mac and into games, nice job apple, not only forgeting pro users into graphics or film but regular day to day  real life situations users who are not just at apple presentations or in a store trying out a mac, to think their is no need for this feature proves who the marketing department is actually targeting for sales,, talk about a flash in the pan presintation

  • Calculate database size for a particular company code

    Hi Experts,
    We have 30 company codes in our FI production system. So to plan another new company code to be deployed into the system, we need to know exact capacity (database) of the previous company code that we already deployed. Kindly let me know whether it possible to calculate the database size for a particular company code in a ERP system.

    >
    Kalyan Kumar Bandlamudi wrote:
    > Hi Experts,
    >
    > We have 30 company codes in our FI production system. So to plan another new company code to be deployed into the system, we need to know exact data capacity (database) of the previous company code that we already deployed. Kindly let me know whether it possible to calculate the database size occupied for a particular company code in a SAP system.
    Its not possible to calculate data size based on company code.
    By creating company code It will not occupy much space. Depends on your posting documents for particular company codes.
    Thanks
    Siva

  • How to calculate table size given the structure.

    Today i was asked how to estimate the size of the table given th transactions,.
    table has 90 column all varchar(10)
    How to calculate the size of table which has no data.
    Message was edited by:
    Maran.E

    hi,
    SQL> create table test as select * from all_objects ;
    Table created.
    SQL> create table test1 as select * from all_objects where 1 = 2 ;
    Table created.
    sql>select segment_name,bytes/1024/1024 "size", blocks
    from dba_segments
    where segment_name in ('TEST','TEST1')
    SEGMENT_NAME
          size     BLOCKS
    TEST1
         .0625          8
    TEST
             6        768regards
    Taj

  • Received for my shipment, but there is the size of memory error

    Apple estimable
    Greetings
    Received for my shipment, but there is the size of memory error
    I got up at the request of any device iPhone 5 golden color 64 and receive your iPhone 5 golden color 32
    I do not want to go back I want to machine used it, but there is a difference in price between the two devices you will recover this amount that he is a natural occurrence of human errors because who does not mistaken does not produce <
    Thank you Please accept the assurances of respect and appreciation.

    There is no one from Apple here. You need to call Apple Sales, as no one here can help you.

  • How to get OLAP cube objects size info?

    Hi,
    I am new at OLAP cube.
    I want to know OLAP Cube objects size information like VIEW.
    is any query to get size of Cube objects?
    Please help me out on this.
    Thank you,
    Nitin

    Nitin,
    This will give you some idea.
    *(1). Size of the whole AW:*
    select dbal.owner||'.'||substr(dbal.table_name,4) awname,
    to_char(round(sum(dbas.bytes)/1024/1024, 1), '999,999.9') as mb, dbas.tablespace_name, logging
    from   dba_lobs dbal, dba_segments dbas
    where  dbal.column_name = 'AWLOB' and dbal.segment_name = dbas.segment_name
    group by dbal.owner, dbal.table_name, dbas.tablespace_name, logging
    order by sum(dbas.bytes) desc
    *(2). Size of internal objects:*
    Each cube has an associated _STORED variable and a 'PXX' partition.
    _PRTCOMP is cube's partition's composite dimension.
    _AGGMAP  is the aggregation map that is used during aggregation of data.
    Replace table AW$BNSOLAP with the name of your AW table.
    select partname,
    round(sum(dbms_lob.getlength(awlob))/1024,0) KB
    from bawolap.aw$bnsolap
    where extnum = 0
    group by partname
    order by kb desc
    +;+

  • "Calculate all sizes" checkbox not working in Lion

    Even when I have checked "Calculate all sizes" in View options, Lion does not show the sizes of many files and folders.  The size information is also missing when I do a command-I.  Has anyone figured out how to make Lion show file sizes?

    On my Lion install (10.7.1), I don't see that checkbox at all in the view options window.  Anybody know why?
    EDIT: Oops, I just realized that checkbox (and several others) are only visible in list view, not column view.

Maybe you are looking for