How do I get the current free and total memory in a node.js workspace?

workspace
nodejs

#1

os.freemem() and os.totalmem() return the machine’s total memory not my VM’s memory (I assume), which is 54.88 GB total memory compared to the total memory of 512 MB that c9 tells me I have. Spawning a child process and using free returns another incorrect value. v8.getHeapStatistics() also returns an incorrect value. process.memoryUsage() returns another incorrect value.

Above is an example of using free with a child process. So how do I get the actual free memory and total memory if none of these methods work?