Parallels Memory Use

Discussion in 'Parallels Desktop for Mac' started by mgorbach, Dec 6, 2006.

  1. mgorbach

    mgorbach Member

    Messages:
    22
    I'm running XP on parallels on Mac Pro 2.66 with 3gb of RAM.
    I noticed something strange: When I start my VM from a shut down state, it boots quickly. At this point I find the VM in windows telling me it is using 180 mb or so of RAM, and Mac OS report parallels is using 200-300 mb or so of real memory in task manager. I start up MS Word, the number don't change much.

    Then ...

    I suspend the VM by quitting parallels. I restart parallels and the VM un-suspends. Look at the activity monitor, I now find parallels using 800-1100mb of "real" memory! What happened? The VM is in the exact same state it was before, yet using almost a gig more of my memory? Why?
    Interestingly, If I restart the VM (in windows), the mem usage goes back down.
     
  2. tgrogan

    tgrogan Pro

    Messages:
    255
    How much memory have you allocated to the VM? It could be that when you suspended, the max allocated was saved, and then restored when you un-suspended. If the numbers seem that way, it is probably not a good thing. In 'normal' operation the VM will only use what it needs of the host memory up to the limit you set - so the low numbers on initial startup are probably reasonable, and, should be the same if you restart. I don't know if the memory usage will go back down after a suspend, but it should given reasonable expectations. You might try doing some things in the VM after un-suspending and see if the memory usage goes down. If not, I would think that a Support entry would be appropriate. The VM should shrink memory requirements anytime it doesn't need them. Good test!
     
  3. mgorbach

    mgorbach Member

    Messages:
    22
    I've now got 768mb allocated for the VM.
    I had more earlier (1300mb) and was getting similar effects.
    It does seem like parallels is saving the maximum allocated ram to the suspend file, then restoring the entire thing ... when window is using almost none of it (less than 200mb!).
    This ends up making suspend/resume slow, and also eats tons of RAM on my computer making it slow to use while running parallels, especially when parallels is saving/loading a resume file to or from disk.
     
  4. tgrogan

    tgrogan Pro

    Messages:
    255
    My Parallels installed machine is down for upgrade now. Could you try looking at the memory use after un-suspending, run something fairly large like Word or IE, and look at it again, then stop whatever you ran and check again. It might shrink usage when it cleans up after a terminated app. This would be windoze doing it, and not Parallels (which shouldn't be allocating it in the first place.)

    I looked at what VMware does, and it seems to suspend and restore based on virtual ram size also, although this is hard to determine due to all of the various caches in between. The thermometer display does seem to progress slower on VMs with more virtual memory. But when I restore a VM win2k), it only increases real ram usage about 10mb until I run something then it only increases real ram usage by the size of the app (1-2mb). This is what Parallels should be doing.
     
  5. mgorbach

    mgorbach Member

    Messages:
    22
    OK ... I've done some addiitonal testing. Same results as before. Here are the numbers I am getting with 768mb max memory assigned to the system:
    1. Parallels uses 76mb or so while not running the vm.
    2. Clean boot VM. Parallels uses 250mb
    3. Starts word 2007 and load a big doc. Parallels uses 300mb or so, at most
    4. Start more apps ... parallels continues to use no more than 350mb.
    5. Start suspending VM. Parallels usage increases VERY quickly while writing the suspend file. It goes up to 860 mb or so before it finishes writing. It then drops immediately to like 75mb when the VM is closed.
    6. Resume the VM. Memory usage climbs slowly from 75mb to 860mb, at which point the restore completes.
    7. Continue using VM, closing apps and so on ... memory uses by parallels continues to stay at 875.

    Seems like it is a bug. This is literally wasting half a gigabyte or RAM memory for no apparent reason. The memory should be released if the VM is not using it. Moreover, all the memory should not be written to disk or restored. Only memory USED should.

    Anyone else able to confirm this? Or give suggestions?
     
  6. mgorbach

    mgorbach Member

    Messages:
    22
    One more thing ... Perhaps I am not understanding Mac memory managment correctly ...
    Despite the differences in real memory used by parallels before/after a suspend cycle, activity monitor shows no substantial difference in the "free" memory.
    Is this significant?
     
  7. tgrogan

    tgrogan Pro

    Messages:
    255
    <<< Seems like it is a bug. >>>

    Agreed. Given the limits of how windoze might handle the memory, Parallels should only be using what is necessary after a restore just like before. I use Linux, but the memory handling is pretty much the same as the Mac.

    <<< activity monitor shows no substantial difference in the "free" memory. >>>

    Again, don't know the details of how a Mac shows this, but Linux includes the swap file in some 'total free memory' displays.

    <<< Moreover, all the memory should not be written to disk or restored. Only memory USED should. >>>

    I confirmed that this is how VMware handles suspend, and it creates a file the full size of memory. (Seems to do restore memory handling properly tho.) I'm guessing that there is a suspend/restore speed reason, since it would be difficult to determine which part of memory is in use on the various guest OSs, compact it on suspend, and then reverse the process on restore.
     
  8. Edd

    Edd Member

    Messages:
    88
    I now always shut windows down because resuming the suspended machine takes longer.. like my old PC booting longer!!

    Macbook Pro 2Gb RAM 2Ghz Core Duo
     
  9. VTMac

    VTMac Pro

    Messages:
    340
    You can't tell if Parallel's is doing something "bad" based on the info you've provided. Mac memory management is very different than windows.

    In Activity Monitor:
    Wired - memory that can't be swapped.
    Active - things in memory that are being used
    Inactive - thing in memory that aren't being used, but could have already been swapped
    Free - physical memory with none of the above remaining

    OSX strives to keep Inactive things in memory (thus keeping Free artifically low) in order to minimize future swapping in of needed pages.

    So when you repeat the steps above, the real question is does the Wired value change significantly. If it does, then there is a real problem. If the Active value is the one that changes, that's not surprising and in fact is expected behavior. This is because in the course of restoring the VM, all those memory inactive memory bits have been touched, thus making them "active again". Over time as other apps are used and those bits are not accessed, they should be converted back to Inactive and thus be available for in RAM use by other apps.

    Edit:
    Here is a link to a good Apple article on this
    http://docs.info.apple.com/article.html?artnum=107918
     
  10. rufosx

    rufosx Member

    Messages:
    22
    Something is definitely wrong, thats for sure.

    If I bring up activity monitor and watch real memory, it jumps by 200 KB every update (5 secs). Having one VM open will grow from 500 MB real mem to 1.22 GB real mem even if I just let it sit there doing nothing for 5 hours.

    Unfortunately, this leads to a data loss situation for me when the VM consumes all available real memory and crashes on the next alloc statement. I filed a report with parallels, but am getting anxious waiting for a fix.
     
  11. VTMac

    VTMac Pro

    Messages:
    340
    You are referring to the memory leak, which is well documented in other threads. This thread was not about the memory leak during regular use. This thread is about whether the suspend/resume operation results in improper allocation of memory that was not previously being used by the VM.
     
  12. rufosx

    rufosx Member

    Messages:
    22
    Sorry, the memory threads have all been pushed off the front page, I guess, and there is no comment or sticky from parallels on it, so I hadn't heard of it before.
     

Share This Page