Know how memory that is free compared to the maximum allowed

Hi i want to know how memory is free compared to the maximum memory set in the jre advanced option or the defaut one
this function is suppose to work, bu im not able to have something good, for example if i set -Xmx256m, so 256mo max thatr the jre can use, and i know that my program use 30mo, i want to see that i have 30mo, but it always give me a weird number, like too low
     * This function will check the maximum memory allowed by the java runtime
     *  and check the number of memory avalaible now and calculate the memory
     *  that is free for using (if he havent enough memory, like only 30M free,
     *  the users will have a message into the java console). The function will
     *  try to release some memory with the garbage collector before displaying
     *  the warning user message
    public void checkMemory()
        /* Call the Garbage Collector and the finalization function 5 times to
            be sure that he has been notified */
        Runtime.getRuntime().runFinalization();
        Runtime.getRuntime().runFinalization();
        Runtime.getRuntime().runFinalization();
        Runtime.getRuntime().runFinalization();
        Runtime.getRuntime().runFinalization();
        System.gc();
        System.gc();
        System.gc();
        System.gc();
        System.gc();
        System.out.println("Total" + Runtime.getRuntime().totalMemory() / 102400);
        System.out.println("Free" + Runtime.getRuntime().freeMemory() / 102400);
        System.out.println("Max" + Runtime.getRuntime().maxMemory() / 102400);
        long freeBytes = Runtime.getRuntime().totalMemory()
            - Runtime.getRuntime().freeMemory();
        long freeMo = freeBytes / 102400;
        if (freeMo < 30)
            System.out.println("You have less than 30mo free for the java "
                + "runtime, you must close all your internet explorer and open "
                + "a new session, sorry for the incovenient and thank you");
        else
            System.out.println("ok");   
    //End of checkMemory function
[\code]
thx                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

ok i know that isnt ok, if i change my division by /
(1024*1024) how can i know how to do the things i want
to do?
Huh? As I mentioned you are not using a meg. You are using some other number. So something is wrong with that.
And as I also mention you are using 'total' memory for your calculation instead of 'max' memory - and again I doubt that is what you want.
>
by the way mo is mb in french but i used this only for
myself... didnt think when i wrote the post
Interesting.

Similar Messages

  • Anyone know how to get a free upgrade on the OSx 10.6

    I've been searching all night, and cant seemtofigure out how to get a free upgrade of the OS X 10.6! Anyone know where or how?

    There is no free upgrade.
    Do you currently have the 10.5.8 Combo update loaded?  (if not download and apply the Mac OS X 10.5.8 Combo Update )
    Then, check that your machine is suitable for Snow Leopard.   It needs to be a Mac computer with an Intel Core 2 Duo processor.   Check by reading the specs.
    Mac OS X v10.6 Snow Leopard -Read the Technical Specifications
    Snow Leopard is a paid upgrade by DVD not a download.  To buy the DVD, if you are from the USA go to … http://store.apple.com/us/product/MC573/mac-os-x-106-snow-leopard.
    In Europe or otherwise substitute your national code in place of /us above.
    In UK go to Apple Store UK       Mac OS X 10.6 Snow Leopard - Apple Store (UK)
    Before you start upgrading, back up your files.   If you are unsure how best to do this, the following link is hugely informative.        Most commonly used backup methods: Apple Support Communities.
    Once you have upgraded to Snow Leopard, if your upgrade took you to 10.6.3 you will need to download and apply the Combo updater.  Mac OS X 10.6.8 Update Combo v1.1  and follow with software updates to pick up the most recent security and iTunes updates.

  • TS3430 does anyone know how to fix itunes when you get the message that it has encountered a problem and needs to close

    does anyone know how to fix itunes when you get the message that it has encountered a problem and needs to close

    You are using ADE on Windows or Mac ? and their versions ??
    Please restart your machine and try once again.
    Thanks

  • My iPad Air have a screen problem so I sent it to iService (I'm Thai) but they told me that they don't know how long that I have to wait until I will get a new one? Can anyone help me?

    My iPad Air have a screen problem so I sent it to iService (I'm Thai)
    but they told me that they don't know how long that I have to wait until I will get a new one?
    Because they said there's no stock in Singapore
    Can anyone help me?
    Just bought on 15/11/2013

    You can call iService and ask to speak with a manager.

  • Hi. I wanted to know how to use my macbook retina to the best of its potential.

    This is what the system is currently showing:
    EtreCheck version: 1.9.12 (48)
    Report generated 21 June 2014 18:32:04 GMT-3
    Hardware Information:
      MacBook Pro (Retina, 15-inch, Late 2013) (Verified)
      MacBook Pro - model: MacBookPro11,3
      1 2.3 GHz Intel Core i7 CPU: 4 cores
      16 GB RAM
    Video Information:
      Intel Iris Pro - VRAM: (null)
      NVIDIA GeForce GT 750M - VRAM: 2048 MB
      Color LCD 2880 x 1800
    System Software:
      OS X 10.9.3 (13D65) - Uptime: 3 days 9:47:47
    Disk Information:
      APPLE SSD SM0512F disk0 : (500.28 GB)
      EFI (disk0s1) <not mounted>: 209.7 MB
      Macintosh HD (disk0s2) / [Startup]: 499.42 GB (266.59 GB free)
      Recovery HD (disk0s3) <not mounted>: 650 MB
    USB Information:
      Apple Internal Memory Card Reader
      Apple Inc. iPhone
      Apple Inc. BRCM20702 Hub
      Apple Inc. Bluetooth USB Host Controller
      Apple Inc. Apple Internal Keyboard / Trackpad
    Thunderbolt Information:
      Apple Inc. thunderbolt_bus
    Gatekeeper:
      Anywhere
    Kernel Extensions:
      [not loaded] net.kromtech.kext.AVKauth (2.3.6 - SDK 10.8) Support
      [not loaded] net.kromtech.kext.Firewall (2.3.6 - SDK 10.8) Support
    Launch Daemons:
      [loaded] com.adobe.fpsaud.plist Support
      [loaded] com.adobe.SwitchBoard.plist Support
      [loaded] com.tunnelbear.mac.tbeard.plist Support
      [running] com.zeobit.MacKeeper.AntiVirus.plist Support
      [running] com.zeobit.MacKeeper.plugin.AntiTheft.daemon.plist Support
    Launch Agents:
      [not loaded] com.adobe.AAM.Updater-1.0.plist Support
      [running] com.kodak.BonjourAgent.plist Support
    User Launch Agents:
      [loaded] com.adobe.AAM.Updater-1.0.plist Support
      [loaded] com.adobe.ARM.[...].plist Support
      [loaded] com.google.keystone.agent.plist Support
      [loaded] com.kodak.KODAK AiO Annual Opt.plist Support
      [loaded] com.kodak.KODAK AiO Firmware Updater.plist Support
      [loaded] com.kodak.KODAK AiO Software Updater.plist Support
      [running] com.kodak.StatisticCollection.plist Support
      [running] com.spotify.webhelper.plist Support
      [running] com.zeobit.MacKeeper.Helper.plist Support
    User Login Items:
      iTunesHelper
      Music Manager
      Spotify
      Google Chrome
    Internet Plug-ins:
      FlashPlayer-10.6: Version: 13.0.0.214 - SDK 10.6 Support
      QuickTime Plugin: Version: 7.7.3
      AdobePDFViewerNPAPI: Version: 10.1.10 Support
      AdobePDFViewer: Version: 10.1.10 Support
      Flash Player: Version: 13.0.0.214 - SDK 10.6 Outdated! Update
      Default Browser: Version: 537 - SDK 10.9
      Silverlight: Version: 5.1.20913.0 - SDK 10.6 Support
      JavaAppletPlugin: Version: 14.9.0 - SDK 10.7 Check version
    Safari Extensions:
      Searchme: Version: 1.3
      Amazon Shopping Assistant: Version: 1.1
      Slick Savings: Version: 2.0
      Ebay Shopping Assistant: Version: 1.1
    Audio Plug-ins:
      BluetoothAudioPlugIn: Version: 1.0 - SDK 10.9
      AirPlay: Version: 2.0 - SDK 10.9
      AppleAVBAudio: Version: 203.2 - SDK 10.9
      iSightAudio: Version: 7.7.3 - SDK 10.9
    iTunes Plug-ins:
      Quartz Composer Visualizer: Version: 1.4 - SDK 10.9
    User Internet Plug-ins:
      npsf_uni: Version: sf 3.3.2.1 Support
    3rd Party Preference Panes:
      Flash Player  Support
    Time Machine:
      Skip System Files: NO
      Auto backup: YES
      Volumes being backed up:
      Macintosh HD: Disk size: 465.12 GB Disk used: 216.84 GB
      Destinations:
      ZU UK 2013-14 [Local] (Last used)
      Total size: 931.51 GB
      Total number of backups: 8
      Oldest backup: 2014-03-16 03:19:04 +0000
      Last backup: 2014-06-07 16:39:22 +0000
      Size of backup disk: Adequate
      Backup size 931.51 GB > (Disk used 216.84 GB X 3)
      Time Machine details may not be accurate.
      All volumes being backed up may not be listed.
    Top Processes by CPU:
          2% WindowServer
          2% fontd
          1% Google Chrome
          0% mds_stores
          0% com.apple.WebKit.Networking
    Top Processes by Memory:
      262 MB WindowServer
      147 MB softwareupdated
      147 MB Google Chrome
      131 MB com.apple.MediaLibraryService
      131 MB iTunes
    Virtual Memory Information:
      9.41 GB Free RAM
      3.67 GB Active RAM
      447 MB Inactive RAM
      1.58 GB Wired RAM
      78.53 GB Page-ins
      0 B Page-outs

    Follow these instructions to uninstall MacKeeper. They have been tested with the most recent version of MacKeeper. Earlier versions than the one released in 2012 require more extensive work to uninstall all its components. Never install such junk on a Mac.
    If you actually used MacKeeper to alter your system, e.g. "remove excess binaries" or such, you will need to reinstall OS X as well as all your additional software. Uninstalling MacKeeper is insufficient to reverse the corruption it is capable of - once again, that is if you used it.
    If you merely installed MacKeeper but did not use it to perform any particular action, the following instructions will suffice.
    If you used MacKeeper to encrypt any files or folders, use MacKeeper to un-encrypt them first.
    Quit the MacKeeper app if it is running.
    Open your Applications folder: Using the Finder's Go menu, select Applications.
    Drag the MacKeeper icon from your Applications folder (not the Dock) to the Trash.
    You will be asked to authenticate (twice):
    You do not need to provide a reason for uninstalling it:
    Just click the Uninstall MacKeeper button. You will be asked to authenticate again.
    After it uninstalls you may empty the Trash and restart your Mac. All that will remain is an inert log file that does nothing but occupy space on your hard disk.
    May I suggest that you review the following setting in System Preferences?
    Although you may easily override that setting, it will serve to protect you from inadvertently installing garbage. The overwhelming majority of Macs I come across have the MacKeeper installer file already present in their Downloads folder, often multiple copies of it. The downloaded file itself can do nothing until it is opened and installed, and the above setting (known as Gatekeeper - not to be confused with MacKeeper) will prevent that from occurring.
    I wanted to know how to use my macbook retina to the best of its potential.
    Never install any product that claims to "speed up", "clean up", "optimize", or "accelerate" your Mac. Without exception, they will do the opposite.
    Never install pirated or "cracked" software, software obtained from dubious websites, or other questionable sources. Illegally obtained software is almost certain to contain malware.
    Don’t supply your password in response to a popup window requesting it, unless you know what it is and the reason your credentials are required.
    Don’t open email attachments from email addresses that you do not recognize, or click links contained in an email:
    Most of these are scams that direct you to fraudulent sites that attempt to convince you to disclose personal information.
    Such "phishing" attempts are the 21st century equivalent of a social exploit that has existed since the dawn of civilization. Don’t fall for it.
    Apple will never ask you to reveal personal information in an email. If you receive an unexpected email from Apple saying your account will be closed unless you take immediate action, just ignore it. If your iTunes or App Store account becomes disabled for valid reasons, you will know when you try to buy something or log in to this support site, and are unable to.
    Don’t install browser extensions unless you understand their purpose. Go to the Safari menu > Preferences > Extensions. If you see any extensions that you do not recognize or understand, simply click the Uninstall button and they will be gone.
    Don’t install Java unless you are certain that you need it:
    Java, a non-Apple product, is a potential vector for malware. If you are required to use Java, be mindful of that possibility.
    Java can be disabled in System Preferences.
    Despite its name JavaScript is unrelated to Java. No malware can infect your Mac through JavaScript. It’s OK to leave it enabled.
    Block browser popups: Safari menu > Preferences > Security > and check "Block popup windows":
    Popup windows are useful and required for some websites, but popups have devolved to become a common means to deliver targeted advertising that you probably do not want.
    Popups themselves cannot infect your Mac, but many contain resource-hungry code that will slow down Internet browsing.
    If you ever see a popup indicating it detected registry errors, that your Mac is infected with some ick, or that you won some prize, it is 100% fraudulent. Ignore it.
    Ignore hyperventilating popular media outlets that thrive by promoting fear and discord with entertainment products arrogantly presented as "news". Learn what real threats actually exist and how to arm yourself against them:
    The most serious threat to your data security is phishing. To date, most of these attempts have been pathetic and are easily recognized, but that is likely to change in the future as criminals become more clever.
    OS X viruses do not exist, but intentionally malicious or poorly written code, created by either nefarious or inept individuals, is nothing new.
    Never install something without first knowing what it is, what it does, how it works, and how to get rid of it when you don’t want it any more.
    If you elect to use "anti-virus" software, familiarize yourself with its limitations and potential to cause adverse effects, and apply the principle immediately preceding this one.
    Most such utilities will only slow down and destabilize your Mac while they look for viruses that do not exist, conveying no benefit whatsoever - other than to make you "feel good" about security, when you should actually be exercising sound judgment, derived from accurate knowledge, based on verifiable facts.
    Do install updates from Apple as they become available. No one knows more about Macs and how to protect them than the company that builds them.
    Summary: Use common sense and caution when you use your Mac, just like you would in any social context. There is no product, utility, or magic talisman that can protect you from all the evils of mankind.

  • I would like to know how to extract my old contacts from the iTunes backup? Please explain in basic english i am a beginner

    I have had my old Iphone 5s replaced with a new one but I would like to know how to extract my old contacts from the iTunes backup? Please explain in basic english i am a beginner

    Hey,
    I think you will find that you have to have a debit/credit card stored on yur account regardless of whether your have iTunes Credit or want to purchase a free App. I don't know why, I assume its for ID verification or is part of the terms and conditions. I occasionally have to re-verify my credit card info even when just trying to run Update on one of my Apps or like I said downloading a free App.
    If you need further clarification all you can do is contact iTunes Support:
                   https://expresslane.apple.com/ServiceOptionAction.action
    Hope this helps. Andrew

  • I am selling my apple mac pro but do not know how to deregister and register it to the new owner; how do you do this?

    I am selling my apple mac pro but do not know how to deregister and register it to the new owner; how do you do this?

    Before you sell or give away your computer, in addition to the steps mentioned in this support article, take these steps:
    Run Apple Diagnostics or the Apple Hardware Test. The buyer will do this (or he should), and you don't want to be surprised by the results.
    Reset the PRAM and the SMC, which might contain personal information.
    If you set a firmware password, remove it by running Firmware Password Utility in Recovery mode.
    If you activated FileVault in OS X 10.7 or later, turn it off.
    If you use Boot Camp, the partition must be deleted
    If you created any other data partitions on the internal drive, remove them in Disk Utility.
    Erase the data partition(s) with the option to zero out data. An SSD doesn't need to be zeroed.
    You can't legally or practically transfer any software downloaded from the Mac App Store to the new owner of the machine, even if it was free. That includes OS X, so if you upgraded to OS X 10.7 or later, you must reinstall  an older OS, either from the installation media, if applicable, or by booting into Internet Recovery (option-command-R at the startup chime.) If you installed from physical media, deliver those to the new owner.
    If you're selling the machine, or donating it in working order, and it originally shipped with OS X 10.4 or 10.5, then you have the option of installing either from the discs that came with it or from a retail Snow Leopard disc (which you must then transfer with the machine.) The buyer should understand that if he doesn't get the original discs from you, he won't get the bundled iLife applications or the Apple Hardware Test. Replacements for the original discs can be ordered from Apple.
    The new owner will have to redownload any software that came from the App Store, including OS X upgrades, under his or her Apple ID. If you ever updated the bundled iLife applications (Garage Band, iMovie, and iPhoto) through the App Store, you can't transfer those either.
    Remove the machine from your list of registered products. If it's still covered by an AppleCare Protection Plan, transfer the coverage to the new owner by following the instructions in the AppleCare Terms and Conditions (under the heading "Transfer of Plan.")

  • Does anyone know how to do a text search in the new Safari for iPad iOS 7?

    Does anyone know how to do a text search in the new Safari for iPad iOS 7?

    The feature has been removed to make safari even less useable. You need to download a third party browser like atomic web browser to get the functionality you want back.
    Like many new IOS 7 "features", safari on the ipad is a FAIL.
    At least you can now bury safari in a folder containing hundreds of icons that you can only view 9 at a time.

  • I'm french, my white Ipod4g 16gb has been stolen 2 days ago, I would like to know how to get it back thanks to the serial number! please

    I'm french, my white Ipod4g 16gb has been stolen 2 days ago, I would like to know how to get it back thanks to the serial number! please

    You can't.
    Change your iTunes (Apple ID) password along with any other password that was stored in the iPod.  If any passwords are associated with credit cards, contact the CC company and get your card replaced (with a new number).  If any passwords are associated with a bank or any other savings institution, contact them also and discuss approprate action with them.
    The only real protection you have is with the personal information on the device rather than the physical device itself.  This requires action before the device is lost/stolen.  If the device has significant personal information, it should have a strong 8-digit (or longer) password AND be configured for automatic wipe in the event of ten consecutive incorrect password entries.

  • HT1918 I am trying to set up my new replacement iphone 5 and i dont know how to transfer my back up to the new phone.

    I am trying to set up a new iphone 5 replacement and i don't know how to get my back up to the new phone.

    Well you would be first need to be using the ITUNES program. Not be on itunes the internet page. The program will usually be a music note icon on your desktop. IF YOU ARE GOING TO THE INTERNET = safari , internet explorer, firefox, etc ....your not using the program itunes. YOur surfing the web.
    with that said , always make sure your running the latest version of itunes. If on a mac  >in the upper left , next to the little Apple, click on the word itunes> check for updates.
    windows users > where it says FIle EDIT View Controls Store Help across the top> select help > check up updates
    >Then plug your phone in
    > then when it appears in the itunes window , click on the iphone > it will bring up the option to restore from back up

  • HT4489 please i need to know how can i import my contacts from the pc saved as vcard i tried to import but it gives me an error

    please i need to know how can i import my contacts from the pc saved as vcard? i tried to import a vcard contact but it gives me an error

    Time Machine is a back up you have to set up to back up before there is a problem like a hard drive failure.
    It is possible to recover files from a failed drive, but it is an expensive proposition.
    There is a faint hope that an app like Disk Warrior or TechTool Pro might repair the drive. You could try making an appointment at an Apple store and ask a technician there to take a look... the diagnosis will not cost you.
    http://www.apple.com/retail/geniusbar/

  • I had to wipe out my laptop, I am waiting to get my serial number back. I need to know how I download Logic Pro 9 with the codes I already have.

    I had to wipe out my laptop, I am waiting to get my serial number back. I need to know how I download Logic Pro 9 with the codes I already have.

    If you bought the boxed set of Logic Studio 2.0  which includes LP9, then you cannot  download it. You must use the disks that came as part of the boxed set... to install from.
    If you bought the App Store version of Logic Pro 9 then go to the Mac App Store App,  Sign into the Store using the same Apple ID you used to purchase LP originally, look under the Purchase Tab and you shouldl find LP9 ready and waiting for you to download and install.

  • Anybody know how to get a macbook to read the 4gb it is supposed to be expandable to

    anybody know how to get a macbook to read the 4gb it is supposed to be expandable to

    Providing more info as to exactly which model Mac you have and which type of memory modules you acquired will help us diagnose the problem better.

  • I have a presentation to make to a customer and need to know how many educational apps are there for the iPad/iPod?

    I have a presentation to make to a customer and need to know how many educational apps are there for the iPad/iPod? More specifically special education apps.
    Thanks

    Keep in mind as well that not all apps are "created equal".  Some are really good, and others are not very good.  You might also want to look at some education sites for recommendations.  An example of a general iPads in education forum is
    http://ipadeducators.ning.com/
    but I imagine some exist for special education needs as well.  Our healthcare organization is using some apps for working with autistic children and find them very helpful. 

  • I just need to know how you get an iTunes library off the original hard drive of a mac and onto an external hard drive and still have it work normally?

    I just need to know how you get an iTunes library off the original hard drive of an imac and onto an external hard drive and still have it work as it normally would?

    http://support.apple.com/kb/HT1449

Maybe you are looking for

  • Stock quantity for a Z report

    Hi Experts I am looking for a report which should display the unrestricted stock of a material in a Particular Plant / storage location. They have an existing Z report for the ATP Quantity for a material taking into consideration of all Open Sales Or

  • ITunes freezes for minutes at a time with iPad

    This is making me crazy! I sync my iPhone('s) and iPods with this computer, and while iTunes may slow down for a few seconds while the iPhone or iPod mounts, it is responsive almost immediately. Update! Now my iPhone freezes iTunes too... this blows!

  • Troubleshoot wifi printer connection

    Im trying to add a printer to my new MacBook Pro. Printer is already installed and working perfectly in wireless mode on my home network using my old Windows laptop. When I try to add printer via system preferences I don't get any printer in the list

  • EHP4 installation in ECC 6.0 on Unix and Oracle

    Hi, We are trying to install EHP4 enhancement package in our HR system which is on ECC 6.0 platform. In the extraction phase it is failing at phase PREP_INPUT/SCANDIR_EXTRACT Process "SAPCAR" exited with 40, see /usr/sap/SID/EHPI/abap/log/CAR.ECO CAR

  • [CS3][JS]Add Tag to text

    hi,    I need to apply tag to selected text in a layout.We can do it manually by selecting text in a layout and then choosing tag from 'Tags' window.The same thing needs to be done using Javascript.I have used the following code,but it adds tag to en