[os] Implement totalmem() and freemem() methods