Now , Let's test that we extend our memory:
main@work:~# sudo free -m
total used free shared buff/cache available
Mem: 488 150 6 9 332 300
Swap: 749 0 749
Now, there is ~300MB free available memory and ~750MB of swap memory. Thus, we can allocate easily ~1000MB.
root@lamp:~# ./memory-test.py 750
success => 750MB was allocated
root@lamp:~# ./memory-test.py 1000
success => 1000MB was allocated
This method can be used to run programs which require more memory than the installed in the machine. However, there is a performance penalty as the system has to read some of the memory from and write it to the slower disk device.