Checking Amount of free memory in java code

Hi, Does anyone know of an accurate way to check the amount of free memory available in the JVM or OC4J container? I've been using "Runtime.getRuntime().freeMemory()", but that's not entirely accurate since it depends on garbage collection. Is there a better way? thanks.

Try a Restore with the most recent iPod Updater.
http://discussions.apple.com/message.jspa?messageID=2488357#2488357
This is another one of my posts with some good links on this subject.
I hope this helps!

Similar Messages

  • How to read the amount of free memory available?

    I need a tool to tell me the amount of free memory left, at any given time. I want to tell my user in advance, and as the experiment proceeds, how much experiment time can remain before we will run out of memory. Yes I know, in a more perfect world the data would be written to disk and not stay in memory; but for now this solution would really help.
    Please be clear: I'm not looking for the performance profiling tool. I need something that will tell my program, at runtime, how much memory is left available to it. Is there any such tool?
    Thanks,
    Ken

    Hey Ken,
           I think this article discusses what you're looking for:
    How Can I Programmatically Find Information About My Computer's Memory Usage?
    http://digital.ni.com/public.nsf/allkb/B5889EB5349FAC478625723E00090265
    Hope this helps!
    --Ryan S.

  • My IPad doesn't show the right amount of free memory

    I purchased some books from Ibook store but when tried to download I got the message not enough space. Before start downloading I had 4 GB of free memory. I erase all the books and after that the amount of memory hasn't returned to the previous level. It has happened again and after some days the issue has been solved without doing something. But now the problem insists.

    iPhone, iPad, and iPod: Understanding capacity
    http://support.apple.com/kb/ht1867
    How much space is used by your Other? You may be able to reduce.
    How Do I Get Rid Of The “Other” Data Stored On My iPad Or iPhone?
    http://tinyurl.com/85w6xwn
    How to Remove “Other” Data from iPhone, iPad and iPod Touch
    http://www.igeeksblog.com/how-to-remove-other-data-from-iphone/
    With an iOS device, the “Other” space in iTunes is used to store things like documents, settings, caches, and a few other important items. If you sync lots of documents to apps like GoodReader, DropCopy, or anything else that reads external files, your storage use can skyrocket. With iOS 5/6/7, you can see exactly which applications are taking up the most space. Just head to Settings > General > Usage, and tap the button labeled Show All Apps. The storage section will show you the app and how much storage space it is taking up. Tap on the app name to get a description of the additional storage space being used by the app’s documents and data. You can remove the storage-hogging application and all of its data directly from this screen, or manually remove the data by opening the app. Some applications, especially those designed by Apple, will allow you to remove stored data by swiping from left to right on the item to reveal a Delete button.
    What is “Other” and What Can I Do About It?
    https://discussions.apple.com/docs/DOC-5142
    iPhone or iPad Ran Out of Storage Space? Here’s How to Make Space Available Quickly
    http://osxdaily.com/2012/06/02/iphone-ipad-ran-out-of-available-storage-space-ho w-to-fix-quick/
    6 Tips to Free Up Tons of Storage Space on iPad, iPhone, and iPod Touch
    http://osxdaily.com/2012/04/24/6-tips-free-up-storage-space-ipad-iphone-ipod-tou ch/
    Also,
    How to Clear Message/iMessage Cache on iPhone & iPad And Reclaim Lots of Free Space
    http://www.igeeksblog.com/how-to-clear-message-imessage-cache-on-iphone-ipad/
    What is Stored in iCloud and What is Not
    https://sites.google.com/site/appleclubfhs/support/advice-and-articles/what-is-s tored-in-icloud
     Cheers, Tom

  • How we can calculate available free memory in java?

    Hi all
    i want to see what is the free heap memory available while running the java application?
    please can anyone tell me how i can do it ?
    thank u

    Perhaps the MemoryUsage class is what you're looking for?
    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/MemoryUsage.html

  • Increase JVM memory using Java Code

    Hi Friends
    I am in a critical situtation and not able get the solution. My application is huge and need of increase in JVM memory. I am able to increase JVM memory in command prompt
    java -Xmx500m classname
    Simarly I am able to run jar file also
    java -Xmx500m -jar sample.jar
    I need to know how to set JVM memory for executable JAR. When I just double-click the JAR application load and i am getting Out Of Memory. I dont what ti use command prompt to execute. Please help me with this program. Thanks in advance

    I gone through the code of ImageJ software. ImageJ is
    a freeware and wrtten in Java. They are setting jvm
    memory in code, getting the description of the code
    was difficult.
    long memoryBytes =
    s = Runtime.getRuntime().maxMemory();
         long memoryMB = memoryBytes/1024/1024;
         long memoryDiff = memoryMB - 64;
    String s = "Runtime.maxMemory: " + memoryMB +
    B + "MB\n";
         s = s + "Difference: " + memoryDiff + "MB";
         System.out.println("s..." + s);
    The above code will give you the memory allocated for JVM. Yes.
    When there is a way to find the memory space,
    there should be some way to set it. No.
    I am still trying to set the memory in code r using external resource.Read reply 4.
    I want to just give the executable jar to users. They
    are not satisified with the bat file and hidding
    command prompt in background.You may be able to use Runtime.exec() to launch another instance of java, with whatever heap setting you desire.

  • ISR4000 free memory issue?

    I just deployed several ISR 4351 routers using either IOS 154-3.S1 or 154-3.S2. Client SNMP server triggers alert for the router's free memory as show below (832) only. I am not sure if this is a problem or not because normally the router's free memory should be much higher that that.
    I have rebooted the routers and also update IOS but the amount of free memory remains.
    Can Cisco or anyone here tell me about this? Thanks
    HOSTNAME>sh proc mem  sorted
    Processor Pool Total: 1728098704 Used:  370046800 Free: 1358051904
     lsmpi_io Pool Total:    6295128 Used:    6294296 Free:        832
     PID TTY  Allocated      Freed    Holding    Getbufs    Retbufs Process
       0   0  377006912   82912960  270797952          0          0 *Init*         
     499   0   34427888      51936   34751952          0          0 SBC main process
      81   0    8884544    1545568    7069200          0          0 IOSD ipc task  
       0   0    9220864    2337440    6915912    8423503          0 *Dead*         
     152   0    9824400    6197304    4044560     494400     494400 CWAN OIR Handler
     386   0    3853712       5160    3890416     799092          0 EEM ED Syslog  

    Hi,
    The requested outputs for two routers are:
    RTR1>sh proc cpu sorted | ex 0.00
    CPU utilization for five seconds: 3%/0%; one minute: 1%; five minutes: 1%
     PID Runtime(ms)     Invoked      uSecs   5Sec   1Min   5Min TTY Process
     554          93          53       1754  1.83%  0.14%  0.03%   2 SSH Process     
     531       92232     5595416         16  0.39%  0.39%  0.39%   0 IP SLAs Responde
     530       91781     5595574         16  0.39%  0.35%  0.37%   0 IP SLAs Control 
     230       22341     2223886         10  0.07%  0.10%  0.08%   0 Inline Power
    RTR2>sh proc cpu sorted | ex 0.00
    CPU utilization for five seconds: 2%/0%; one minute: 0%; five minutes: 0%
     PID Runtime(ms)     Invoked      uSecs   5Sec   1Min   5Min TTY Process
     504          95          55       1727  1.83%  0.14%  0.03%   2 SSH Process     
     219       34575     2743896         12  0.15%  0.12%  0.13%   0 Ethernet Msec Ti
     230       24330     2187012         11  0.07%  0.10%  0.08%   0 Inline Power    
     173        7807      344731         22  0.07%  0.04%  0.02%   0 VRRS Main thread
      81        9463       75354        125  0.07%  0.05%  0.04%   0 IOSD ipc task 
    They are NOT in production yet so only the management interface is UP. We are worry if this would cause problem once put in the production. Thanks

  • Monitoring Free memory in solaris 8

    Hi,
    I will like to monitor the amount of free memory in my system. I understand that as Solaris 8 implements "cyclical page cache", the value read from the "free list" column of vmstat will be much more accurate than previous version.
    But when i run it on my sparc, the value is 50208KB.
    But when i run Memtool 3.8.2, these are the values
    Total memory:119Mb
    Kernel memory:10Mb
    Application:52Mb
    Exe and lib :15Mb
    File Cache: 33Mb
    Free, file cache : 3Mb
    Free, free :3 Mb
    (33 + 3 + 3) =>39Mb
    Can someone tell me how to reconcile the values from this 2 tools? Which is more accurate? (or is there a better method?)
    Thanks!

    Kalpesh
    if you're reading this it would be @&$%#&$( useful to folks in this list to actually BE ABLE TO REFER TO KNOWN SUN BUGS and to be able to report their own.
    I couldn't log in to the sunsolve site - do I need a special password to be able to view bug status? (I agree I can find patches there, but
    not being able to view/report bugs as a user under the free license program is ridiculous).
    How can we get resolution on this?

  • Linux free memory confusion.

    Hi,
    I am trying to know the amount of free memory in linux however get more confused.
    all hereunder commands run during one minute at the same box:
    1)
    $ free -m
    total used free shared buffers cached
    Mem: 24118 23992 126 0 0 14193
    -/+ buffers/cache: 9799 14319
    Swap: 16383 0 16383
    2)
    $top
    Mem: 24697152k total, 24573876k used, 123276k free, 0k buffers
    Swap: 16777208k total, 84k used, 16777124k free, 14539380k cached
    3)
    $cat /proc/meminfo
    MemTotal: 24697152 kB
    MemFree: 122956 kB
    Buffers: 0 kB
    Cached: 14556828 kB
    SwapCached: 0 kB
    Active: 9905800 kB
    Inactive: 14418416 kB
    HighTotal: 0 kB
    HighFree: 0 kB
    LowTotal: 24697152 kB
    LowFree: 122956 kB
    SwapTotal: 16777208 kB
    SwapFree: 16777124 kB
    Dirty: 36 kB
    Writeback: 0 kB
    AnonPages: 9767396 kB
    Mapped: 57128 kB
    Slab: 179524 kB
    PageTables: 32464 kB
    NFS_Unstable: 0 kB
    Bounce: 0 kB
    CommitLimit: 29125784 kB
    Committed_AS: 11207060 kB
    VmallocTotal: 34359738367 kB
    VmallocUsed: 8516 kB
    VmallocChunk: 34359729783 kB
    HugePages_Total: 0
    HugePages_Free: 0
    HugePages_Rsvd: 0
    Hugepagesize: 2048 kB
    3)
    Script:
    ---memScriptStart----
    TOT=`cat /proc/meminfo | grep MemTotal: | awk '{print $2}'`
    USED=`cat /proc/meminfo | grep Active: | awk '{print $2}'`
    FREE=$[$TOT - $USED ]
    LOG=/tmp/mem_monitor.log
    echo > $LOG
    SEND=0
    if [ "$USED" -gt "0" ]; then
    USEDPERC=$[$USED * 100 / $TOT]
    echo "Used Percentage : $USEDPERC %"
    TOTMB=$[$TOT / 1024 ]
    USEDMB=$[$USED / 1024 ]
    FREEMB=$[$TOTMB - $USEDMB ]
    # echo "Used Percentage : $USEDPERC"
    if [ "$USEDPERC" -gt "30" ]; then
    SEND=1
    STATUS="Warning"
    echo "------------------------------------------------------------------" >> $LOG
    echo `hostname` >> $LOG
    echo "------------------------------------------------------------------" >> $LOG
    echo "Total Memory (MB) : $TOTMB" >> $LOG
    echo "Used Memory (MB) : $USEDMB" >> $LOG
    echo "Free Memory (MB) : $FREEMB" >> $LOG
    echo "Used Percentage : $USEDPERC %" >> $LOG
    echo "------------------------------------------------------------------" >> $LOG
    if [ "$USEDPERC" -gt "95" ]; then
    STATUS="Critical"
    fi
    fi
    fi
    if [ "$FREEMB" -eq "0" ]; then
    SEND=1
    STATUS="Fatal"
    echo "------------------------------------------------------------------" >> $LOG
    echo " No free memory available in " `hostname` >>$LOG
    echo "------------------------------------------------------------------" >> $LOG
    fi
    cat $LOG
    ---memScriptEnd----
    Samle output:
    hostname
    Total Memory (MB) : 24118
    Used Memory (MB) : 10532
    Free Memory (MB) : 13586
    Used Percentage : 43 %
    Thank you,
    Edited by: user592759 on May 4, 2011 4:03 AM

    Each of the methods you listed will show you memory information, so does also vmstat, which can also be helpful. But memory management is somewhat more complex than total, used and free. What about shared memory /dev/shm, for instance? From what I understand, reporting the free memory will not help you to determine if the computer has enough memory available to perform additional tasks. Your script seems to take the total amount of memory minus the active memory and considers the rest to be free, which is of course different than what the system tools report as free.
    The following should describe some of the information available:
    http://www.redhat.com/advice/tips/meminfo.html
    As long as the server isn’t using swap space, there’s shouldn’t be a concern about physical memory. The memory that’s currency being registered as used can be replaced if another program needs it. To get a "true" reading of memory usage, look at is the -/+ buffers/cache. From an application perspective, the output above shows this server has about 14G of free memory.
    http://stackoverflow.com/questions/1407643/how-is-the-linux-calculating-memfree
    MemFree in /proc/meminfo is a count of how many pages are free in the buddy allocator. This buddy allocator is the fundamental unit of physical memory allocation in the kernel; however there are a lot of ways pages can be returned to the buddy allocator in time of need - for example, freeing empty SLABs, discarding cache/buffer RAM (even if this means invalidating PTEs in a running process), or as a last resort, swapping things out.
    In fact, MemFree is generally controlled to be only 5-10% of total physical RAM, with any extra free RAM being coopted into cache as time goes on. As such, MemFree alone is a very incomplete view of the overall memory situation.

  • Free Memory Space

    Can i get the memory usage status from my card?
    i use Gem+ RAD211 PK Card (JC211, VOP 2.0.1),
    is there any general method to get card's memory status?
    or need to ask the card vendor?
    Thanks a lot.

    Such feature is out of the scope of any global specifications (such as Javacard or Global Platform), thus it is vendor-specific.
    For example, the amount of free memory on OCS cards (not on all types, however) could be retrieved using the following command:
    CLA:80 INS:CA P1:DF P2:64 Le:05
    Gemplus could implement this feature in some another way or couldnt implement at all, I don't know.

  • Memory gates checking failed because the free memory is less than 5% of total memory

    ·         Business
    Goal: Achieve a stable environment
    ·         Repro
    Steps: n/a
    ·         Expected
    Results: I expect the MSCRM Async services to use a relatively static amount of RAM
    ·         Actual
    Results: Over the weekend, the memory hit critical mass and CRM failed
    ·         Environment:
     Windows Server 2008, SQL Server 2008, CRM 2013 On Premise - both on the same box, Email Router is installed on the same box. We have not yet applied either of the two new UR for 2013.
    I'm currently experiencing a memory leak in our production environment. I will fill out the details shortly.
    Here's the error:
    Log Name:      Application
    Source:        System.ServiceModel 4.0.0.0
    Date:          4/20/2014 11:39:14 PM
    Event ID:      3
    Task Category: WebHost
    Level:         Error
    Keywords:      Classic
    User:          NETWORK SERVICE
    Computer:      server.domain.com
    Description:
    WebHost failed to process a request.
    Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/58366981
    Exception: System.ServiceModel.ServiceActivationException: The service '/VisualWorkplace/XRMServices/2011/Organization.svc' cannot be activated due to an exception during compilation. 
    The exception message is:Memory gates checking failed because the free memory (1240145920 bytes) is less than
    5% of total memory.  As a result, the service will not be available for incoming requests.  To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config
    element.. ---> System.InsufficientMemoryException: Memory gates checking failed because the free memory (1240145920 bytes) is less than 5% of total memory.  As a result, the service will not be available for incoming requests.  To resolve
    this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.
       at System.ServiceModel.Activation.ServiceMemoryGates.Check(Int32 minFreeMemoryPercentage, Boolean throwOnLowMemory, UInt64& availableMemoryBytes)
       at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CheckMemoryCloseIdleServices(EventTraceActivity eventTraceActivity)
       at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
    We just recently increased the available memory from 8GB to 24GB to help ensure that there is enough memory. This error never happened on CRM v4. According to the resource monitor, SQL is only reserving 20.7GB of RAM and there is 694MB of RAM in Standby.
    The main Async service is using 660MB and the maintenance Async service is using 265MB.
    To resolve the issue temporarily, I restarted both Async services this morning. Shortly after everything came back, they were holding fairly steady around 350MB and 200MB. It's been six hours since then.
    The last time I spoke with Microsoft about a similar problem, they suggested increasing the amount of RAM.

    It became more and more of a problem. It was impacting the users in a more subtle way at first. You couldn't configure the CRM for Outlook client. After a while, they couldn't use CRM in Outlook at all and users reporting not being able to complete phone
    call activities. I opened a ticket with MS and they suggested the same as Wilson Lou did. The organization error had nothing to do with the creep on the async services usage of RAM. It was indeed caused by SQL stealing all of the memory. Limiting the max usage
    to 24GB RAM has resolved that error. 
    My Async processes are still using a LOT of RAM, but now that I have more than enough RAM, it doesn't seem to be a problem anymore. They are currently using about 700MB RAM each.
    Also, I have upgraded to SP1, UR2.
    Eric Hula - CRM Administrator

  • How to check for a logic bomb in compiled java code ?

    I have couple of security requirements.
    1. How do I check for logic bomb in the compiled java code ?
    2. Is there any way to monitor memory utilized by class when running inside a constructor ?

    1. Let me see if you can define 'logic bomb', then maybe a answer can be supplied. If you simply mean malicious code, then in general you cannot. You can attempt to do the kinds of things that antivirus software does, like check for the existence of known malicious code and code patterns, but that won't work any better on Java than it does on anything else.
    2. Google java profiling. Also, for something relatively simple, read about jconsole.

  • The amount of free SGA memory available in the database

    Hi,
    How can we calculate the amount of free SGA memory available from the instance if the database is not set for Memory management.If the sga_max_size is set for a particular value and the db_cache_size and the shared_pool and all other components are specified,how can one determine whether all the memory allocated for SGA is in use?

    How can we calculate the amount of free SGA memory available from the instance if the database is not set for Memory management.When the SGA is allocated, the memory is fixed, and none of it is "free" really.
    how can one determine whether all the memory allocated for SGA is in use? Are you asking about usage WITHIN the pools? If so, shortly after startup the database buffer and shared_pool will fill-up and stay full . . . . .
    Here is the script that I use to see inside the data buffer contents:
    set pages 999
    set lines 80
    spool blocks.lst
    ttitle 'Contents of Data Buffers'
    drop table t1;
    create table t1 as
    select
    o.object_name object_name,
    o.object_type object_type,
    count(1) num_blocks
    from
    dba_objects o,
    v$bh bh
    where
    o.object_id = bh.objd
    and
    o.owner not in ('SYS','SYSTEM')
    group by
    o.object_name,
    o.object_type
    order by
    count(1) desc
    column c1 heading "Object|Name" format a30
    column c2 heading "Object|Type" format a12
    column c3 heading "Number of|Blocks" format 999,999,999,999
    column c4 heading "Percentage|of object|data blocks|in Buffer" format 999
    select
    object_name c1,
    object_type c2,
    num_blocks c3,
    (num_blocks/decode(sum(blocks), 0, .001, sum(blocks)))*100 c4
    from
    t1,
    dba_segments s
    where
    s.segment_name = t1.object_name
    and
    num_blocks > 10
    group by
    object_name,
    object_type,
    num_blocks
    order by
    num_blocks desc
    Hope this helps. . ..
    Don Burleson
    Oracle Press author

  • How to get the amount of free physical memory?

    How to get the amount of free physical memory?
    (without sudo or root)

    vmstat will give it to you.
    Although the question depends a bit on what you mean by free memory.
    The figure vmstat labels free (in any reasonably recent version of solaris) actually represents memory mostly filled with cached file contents. So it represents memory that can be easily released if needed by something more important.
    Like most unix versions, solaris will use any free memory to cache files thats have been read/written previously just in case they are needed again

  • Upgraded to IO6, seems like the amount of system memory to run is higher, this causes issues with some Apps. I can't get SIRI to work because the amount of free system memory is not enough. how can I tell what is eating the system memory?

    Upgraded to IO6, seems like the amount of system memory to run is higher, this causes issues with some Apps. I can't get SIRI to work because the amount of free system memory is not enough. how can I tell what is eating the system memory?

    Upgraded to IO6, seems like the amount of system memory to run is higher, this causes issues with some Apps. I can't get SIRI to work because the amount of free system memory is not enough. how can I tell what is eating the system memory?

  • How to check actual allocated and used memory for java process in solaris?

    Hi,
    I'm testing performance for java application on solaris 10. And I would like to know how to measure actual memory allocated and used for java process.
    I'm setting -Xms512m -Xmx512m for my java process and I use prstat command to monitor it's memory. But I found that when I run prstat to check, in SIZE column is more than I setting (found 644).
    So I'm don't know the actual memory that java process used. (In this case,is it mean the process use memory (644) more than setting (512)?)
    Thank you.

    With Xms/Xmx you specify the Java heap size. On top of that comes the permanent generation (default max size 64m) and the C part of the process (the JVM itself with all its libraries and data).
    With "ps -e -o pid,vsz,rss,args" you get the virtual and set resident size of your processes.
    Nick.

Maybe you are looking for