Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh


Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have VMware for Ubuntu on my PC which is Windows 10.
I run a python script on the VMware, I specified 16GB for VMware.

The script has to calculate the maximum RAM memory percentage.


I know this psutil.virtual_memory() will calculate

((𝑡𝑜𝑡𝑎𝑙 𝑚𝑒𝑚𝑜𝑟𝑦 −𝑎𝑣𝑎𝑖𝑙𝑎𝑏𝑙𝑒 𝑚𝑒𝑚𝑜𝑟𝑦 )/(𝑡𝑜𝑡𝑎𝑙 𝑚𝑒𝑚𝑜𝑟𝑦 ))  ∗100

My question is that, does the total memory means 16GB ? or the whole PC total memory which is 32GB.
Please I couldn't find enough answer in the web.
Saloon Keeper
Posts: 25470
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch, Aminah!

Within a VM, the only memory that counts is the memory that was defined for the Virtual Machine. You should not expect to be able to tell how much RAM (physical or virtual) is available on the host (real) machine that contains the VM unless you are using a special package that escapes data flow from the VM to the host. The standard python (and Java) memory services don't do that. They can only report what's available in the VM.

Note that a VM can define itself to have more memory than the physical machine that contains it does. Although if you're not careful you can end up with serious VM page thrashing issues.
Squanch that. And squanch this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    Bookmark Topic Watch Topic
  • New Topic