How to get the memory usage for the system in Erlang?

Bengt Kleberg <>
Wed Jun 7 10:11:06 CEST 2006


On 2006-06-05 21:04, Tony Zheng wrote:
> Hi
> I want to check the memory usage(the amount of free memory available)
> for the system in Erlang on Unix platform(Sun Solarix 10). I used
> memsup:get_memory_data() or memsup:get_system_memory_data() command to
> do it. But both of them gave an error message. Are there any suggestions

it is not mentioned in the documentation, but the memsup module has a 
start_link/0 function you can call
memsup:start_link().
{ok,<0.49.0>}

after that it works.
memsup:get_memory_data().
{0,0,{<0.49.0>,0}}

note that you are linking to the memsup process, so if your process (the 
shell?) dies then the memsup process will die to.


bengt
-- 
    EPO guidelines 1978: "If the contribution to the known art resides
    solely in a computer program then the subject matter is not
    patentable in whatever manner it may be presented in the claims."



More information about the erlang-questions mailing list