Alex Rivera | Logout

How to log the memory consumption on Linux?

Asked 2009-12-08T16:41:26.790
70

Is there any ready-to-use solution to log the memory consumption from the start of the system? I'd like to log the data to simple text file or some database so I can analyze it later.

I'm working on Linux 2.4-based embedded system. I need to debug the problem related to memory consumption. My application automatically start on every system start. I need the way to get the data with timestamps from regular intervals (as often as possible), so I can track down problem.

The symptoms of my problem: when system starts it launched my main application and GUI to visualize the main parameters of the system. GUI based on GTK+ (X server). If I disable GUI and X server then my application works OK. If I enable GUI and X server it does not work when I have 256 MiB or 512 MiB of physical memory installed on the motherboard. If I have 1 GiB of memory installed then everything is OK.

Edit
Report

1 Answer

8

There's a program called

sar

on *nix systems. You could try to use that to monitor memory usage. It takes measurements at regular intervals. Do a

man sar

for more details. I think the option is -r for taking memory measurements, -i to specify the interval you'd like.

answered 2012-12-14T09:02:04.727

Your Answer