                 data.usedDiskSpace = usedSpace
         data
 
+    # Return memory information from a complex free command (remove useless
+    # information)
     getMemoryInfos: (callback) ->
         data = totalMem: os.totalmem() / (1024)
         exec freeMemCmd, (err, resp) ->

                data.freeMem = line
                callback null, data

    getDiskInfos: (callback) ->
        @controllerClient.client.get 'diskinfo', (err, res, body) ->
            if err or res.statusCode isnt 200


freeMemCmd = "free | grep cache: | cut -d':' -f2 | sed -e 's/^ *[0-9]* *//'"


# Utilities to get memory consumption and disk usage.
class exports.MemoryManager

    constructor: ->
        @controllerClient = new ControllerClient
            token: @_getAuthController()

    # Get token from token file if in production mode.
    # TODO: this method should be integrated to the controller client.
    _getAuthController: ->
        if process.env.NODE_ENV is 'production'
            try
