• Where is the memory going?

    Home » Forums » AskWoody support » Windows » Windows 10 » Windows 10 version 22H2 » Where is the memory going?

    Author
    Topic
    #2584873

    My system was slow so I fired up task manager to see what what going on .  and it tells me that I’m using 31.8 gigs of my 32gigs of memory. so I switch over to details and in adding up everything there I can only get about 11gigs accounted for… where are the other 20 gigs hiding??

    Viewing 6 reply threads
    Author
    Replies
    • #2584874

      NOTE: Restarting the PC frees up RAM

      Windows - commercial by definition and now function...
    • #2584878

      Thanks — I figured out where the memory was going.  My Virtualbox VDI had ballooned to 150. megs [and when I exited it all the mysterious missing memory came back].

      My problem now is that I can’t fix it.  I opened the Virtualbox manager and selected the VM, clicked on tools and it showed me the nasty vdi, and it clearly said “Virtual Size 150gigs” and and “actual size 48gigs” [which is exactly right — it is supposed to be a 50gig VM].  But when I try to shrink it with the “size” slider, it won’t let me get below 125 gigs.   [and , indeed the size of the .vdi file is 50gigs].   I’m not sure why it won’t let me fully shrink it.

      • #2584883

        The virtual size is what you set when the VM was initially created. I don’t think it can be changed. However the “actual size” of the VDI file can be compressed/shrunk, see the link below for more info.

        https://www.virtualbox.org/manual/UserManual.html#vboxmanage-modifymedium

        Edit: you will need to run Sdelete on the VM. It’s available from Microsoft here: https://learn.microsoft.com/en-us/sysinternals/downloads/sdelete

        Below are steps I use to shrink the size of the VDI. Depending on the OS of your host system (ex. Windows or Linux) and the location of your VDI file you will need to adjust the command in step 6.

        1. Clean up temp folders/files on VM
        2. Run Disk Defrag on VM
        3. On the VM, open command prompt as administrator, change directory to location of sdelete
        4. Run command: sdelete.exe c: -z
        5. Shut down VM
        6. Open terminal (command prompt on Windows) and run: vboxmanage modifymedium disk “/home/user/VirtualBox VMs/Win8.1/Win8.1.vdi” –compact

    • #2584880

      I’m using VirtualBox too for a Windows 8.1 VM although on Linux Mint. But in any case you should be able to adjust the amount of memory that the VM is allowed to use. Shut down the VM first then in VirtualBox Manager click on the name of VM then click settings. Under “System” there should be a slider for “Base memory” or a box to the far right to manually enter the amount.

    • #2584881

      I’ve done all that but it won’t let me make it any smaller than 125 gigs.   Attached is my attempt and you can see the red ‘!’ when I tried to make it 50 gigs

      vb

    • #2584886

      Thanks for pointing me at vboxmanage .  I *think* what I want is “modifymedium”. \  What am I doing wrong.  Here’s my VDI:

      Directory of E:\Virtualbox VMs\win10

      09/02/2023 12:15 PM <DIR> .
      09/02/2023 12:15 PM <DIR> ..
      09/01/2023 07:09 AM <DIR> Logs
      08/28/2023 02:22 PM <DIR> Snapshots
      09/02/2023 12:15 PM 6,845 Win 10.vbox
      09/02/2023 12:15 PM 52,452,917,248 Win 10.vdi

      It says it is 50 or so gigs, which is correct, but as I posted, it *thinks* it wants 150gigs.  when I try to run it I do:

      C:\Program Files\Oracle\VirtualBox>vboxmanage modifymedium –compact “e:\Virtualbox VMs\win10\win10.vdi”
      VBoxManage.exe: error: Could not find file for the medium ‘E:\Virtualbox VMs\win10\win10.vdi’ (VERR_FILE_NOT_FOUND)
      VBoxManage.exe: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component MediumWrap, interface IMedium, callee IUnknown
      VBoxManage.exe: error: Context: “OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())” at line 191 of file VBoxManageDisk.cpp

      so I don’t know what to do — that’s the correct path but it gets “not found”.   and I also tried feeding it the .vbox file and it couldn’t find that, either….

      • #2584888

        Looks like there is a space missing for the name of the vdi file (from looking at your screenshot above). So the command would be: vboxmanage modifymedium –compact “E:\Virtualbox VMs\win10\Win 10.vdi”

        But keep in mind this command only shrinks the “actual size” of the VDI file and per my steps listed above, ONLY after cleaning up any unused files (ex. temp files), run disk defrag and then run sdelete on the VM to zero out that unused space.

        From the VirtualBox website:

        “–compact

        Compresses disk images by removing blocks that contain only zeroes. This option shrinks a dynamically allocated image and reduces the physical size of the image without affecting the logical size of the virtual disk.

        You can use this option for base images and for differencing images that are created as part of a snapshot.

        Note: Before you compress the image, you must use a suitable software tool to zero out free space in the guest system. For example:

        Windows guests. Run the sdelete -z command.

        Linux guests. Use the zerofree utility, which supports ext2 and ext3 file systems.

        Mac OS X guests. Use the diskutil secureErase freespace 0 / command.”

        Otherwise the “virtual size” is from when the VM was initially created and I don’t think it can be changed without creating a new VM and setting it to what you want, then possibly cloning the existing VDI. But not sure on that as I have never done it so may be best to research the VirtualBox website and forums for more info on it.

        However it sounded like the real issue you were having was high memory use. So not quite sure how shrinking the VDI size is going to help unless free space on the E: drive is getting low and it’s somehow affecting your host operating system as well. But usually the host OS such as Windows would be installed on the C: drive.

        • #2584894

          I agree with Mothy’s post.
          You are coming to some wrong conclusions.
          Your main concern was that you were using so much memory (ram) and could not see what was using it in task manager. Were you running task manager in the host OS or the virtual machine OS?
          A right conclusion would be shutting down the virtualbox OS returns the memory used as seen in the host OS task manager. You did not say what your host OS was? I see from your screenshot that the virtualbox is Windows 10. If you are worried about using too much ram, look at how much system base memory (ram) you have assigned to your Win 10 virtualbox.
          Note: The virtual disk size of the virtualbox is “not” related to the amount of ram memory used. You have your virtualbox dynamic disk set to 150.08 G and your current actual size is 48.85G. This does not mean that your disk usage ballooned to 150G. It only means your virtual machine can dynamically grow to 150G if needed. If you were getting low on space in the virtualbox OS, you would get a low on space error while running the Win 10 virtual machine.
          Yes, you cannot easily shrink a virtual machine. There is a “non-trivial” procedure that must be followed. Google “How to Shrink a VirtualBox Virtual Machine” or “Resize a Virtual Box” to learn more.  I would advise against trying changing this. I don’t think this is your problem.

    • #2584895

      great catch — I didn’t see the missing space.  Still didn’t work:

      I tried to follow the direcdtions in the website and I got

      C:\Program Files\Oracle\VirtualBox>vboxmanage modifyhd “e:\Virtualbox VMs\win10\win 10.vdi” –resize 25000
      0%…
      Progress state: VBOX_E_NOT_SUPPORTED
      VBoxManage.exe: error: Failed to resize medium
      VBoxManage.exe: error: Shrinking is not yet supported for medium ‘E:\Virtualbox VMs\win10\Win 10.vdi’
      VBoxManage.exe: error: Details: code VBOX_E_NOT_SUPPORTED (0x80bb0009), component MediumWrap, interface IMedium
      VBoxManage.exe: error: Context: “enum RTEXITCODE __cdecl handleModifyMedium(struct HandlerArg *)” at line 816 of file VBoxManageDisk.cpp

      WHy is shrinking not suppported???  I’m running 6.1.44r156814

      • #2584900

        You were attempting to resize it instead of shrink it. The resize command can only expand/increase size not reduce it as stated on the VirtualBox website:

        “–resize=size

        Specifes the new capacity of an existing image in MB. You can use this option only to expand the capacity of an image. You cannot shrink the capacity of an image.”

        But as Sueska mentioned above I think you’re confusing the size allocated to the VDI to the high memory use that caused the performance issues. They are not the same. So there really is no point in trying to shrink the size of the VM unless there are free space issues on the E: drive or you just want to clean up the VM and reduce its size. To be clear, even if you were to shrink the size it will only go down from the current actual size of 48.85 GB (from your screenshot above).

    • #2584901

      The VM is contained in a big file. When you create the VM, you set a maximum size for that file. Think of that as equivalent to the size of a HDD.
      Windows is installed in that VM. It does not have to take up the entire space any more than it has to fill the entirety of a HDD.
      Reducing the maximum size of the VM does not change the size of the installed OS. Nor does it mean that the VM takes up the entire maximum space at any given time. You can run Disk Cleanup, delete temporary files and caches, run Maintenance, etc. within the installed OS to reduce it’s size, but that does not reduce the maximum space dedicated to the VM.

      I use Parallels software for VMs on a Mac. When I create a VM, I designate a give amount of RAM for that VM, balancing it with the total amount of RAM on the host and the amount of RAM required for the host to operate effectively. The amount of RAM used by the VM should not exceed the amount assigned to it. It should not be able to run the host out of RAM, use all the host’s RAM.

      One possibility would be that the VM is not closed (running multiple incidents), or the RAM it uses is not released when it does close. That might reduce the amount of total amount of RAM available to the host device, and on restart of the VM, it is again assigned it’s allotment of the RAM.

      Suggestion: after using and closing the VM, restart the computer, which would clear the RAM. Restart the VM and see if the problem reoccurs.

       

      1 user thanked author for this post.
    Viewing 6 reply threads
    Reply To: Where is the memory going?

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: