Question: I'm wondering if there is a module in python standard library I can use to get the total physical memory size. I know I can use psutil, but it would be great if my python script can run without installing external module. Thanks!

Edited:
Sorry guys, I forgot to mention that I'm using a mac OSX. Thanks for all the windows solutions tho!

Answer: 
If you're on Windows, you can use [GlobalMemoryStatusEx](https://msdn.microsoft.com/en-us/library/windows/desktop/aa366589(v=vs.85).aspx), which requires only ctypes and no additional modules.

```
from ctypes import Structure, c_int32, c_uint64, sizeof, byref, windll
class MemoryStatusEx(Structure):
    _fields_ = [
        ('length', c_int32),
        ('memoryLoad', c_int32),
        ('totalPhys', c_uint64),
        ('availPhys', c_uint64),
        ('totalPageFile', c_uint64),
        ('availPageFile', c_uint64),
        ('totalVirtual', c_uint64),
        ('availVirtual', c_uint64),
        ('availExtendedVirtual', c_uint64)]
    def __init__(self):
        self.length = sizeof(self)

```

Used like this:

```
>>> m = MemoryStatusEx()
>>> assert windll.kernel32.GlobalMemoryStatusEx(byref(m))
>>> print('You have %0.2f GiB of RAM installed' % (m.totalPhys / (1024.)**3))

```

See [here](https://stackoverflow.com/a/1911863/1530134), [here](https://stackoverflow.com/a/760276/1530134), and [here](https://apple.stackexchange.com/questions/4286/is-there-a-mac-os-x-terminal-version-of-the-free-command-in-linux-systems) for information for MAC OS X/other UNIX systems.
Based on this [discussion](http://blenderartists.org/forum/archive/index.php/t-205082.html) there seems to nothing in Python's standard library that'll do that. Here's a few that might help:

* [Python System
Information](https://bitbucket.org/chrismiles/psi/wiki/Home)
* [Psutil](https://github.com/giampaolo/psutil) (Up-to-date, good cross  

platform support, I've used this before, not in Blender though)
* [SIGAR](http://support.hyperic.com/display/SIGAR/Home) (looks fairly 
recent, supports a number of platforms)