Linux virtual memory consumption after parsing log file

0

I wrote a parser to read the auth.log. For some reason while parsing auth.log I get that VSZ is larger than the total physical memory, which is 2GB. Depending on the size of auth.log and how long reader has been running, VSZ will increase (sometimes up to ~8GB).

How normal is it? What could be the reason of this memory consumption?

# ps aux
USER   PID  CPU %MEM     VSZ   RSS   TTY STAT START  TIME  COMMAND
root 17547  0.7  1.4 3123744 30820 pts/2  Sl+ Jul30 11:42 ./reader auth.log

# free
             total       used       free     shared    buffers     cached
Mem:       2063568    1842232     221336          0     179084    1057680
-/+ buffers/cache:     605468    1458100
Swap:      4032504        288    4032216

Mike Darrow

Posted 2013-08-01T04:07:17.403

Reputation: 3

Without seeing the script, the most likely reason is you are reading the entire log into memory, or you have a memory leak through not releasing resources. Would you like to add the script to the post? – Paul – 2013-08-01T04:27:51.877

@Paul: Is that were true, why would his resident set size be so low? – David Schwartz – 2013-08-01T04:32:29.390

@Paul: Thanks. Yes, I'm reading almost the entire log into memory. I'm not able to post it due to my job. – Mike Darrow – 2013-08-01T12:50:53.647

Answers

1

It's normal. Virtual memory is so cheap, effectively free, that there's pretty much no point in trying to reduce your consumption of it.

David Schwartz

Posted 2013-08-01T04:07:17.403

Reputation: 58 310

Thanks. Could this potentially crash the machine if it gets to large for one process? – Mike Darrow – 2013-08-01T12:54:30.570

@MikeDarrow: No. Virtual memory is just address space. – David Schwartz – 2013-08-01T15:17:57.317