Re: Fwd: System memory increased while process is running is not released back upon process exit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Joel Fernandes wrote:
Just forwarding to the list

---------- Forwarded message ----------
From: Joel Fernandes <agnel.joel@xxxxxxxxx>
Date: Tue, May 4, 2010 at 12:40 PM
Subject: Re: System memory increased while process is running is not
released back upon process exit
To: ravikumar <ravikumar.vallabhu@xxxxxxxxx>


Hi Ravikumar,

I've some application which will do much I/O disk. While this application
is running the memory usage of system is continuously increasing.
After stopping my process , no memory usage increased.  But
leaked/increased memory was not released back upon my application exit.This
 proves that there is no potential memory leaks in my process. Also
 /proc/<PID>/status file contents are not changing from start to end.

Where is leaked memory was gone even though my application terminates ?

I assumed that memory reserved for kernel buffer cache is not releasing
back. Correct me if assumption is wrong.

Your assumptions is correct.

I stuck up at this stage to analyze the issue.
Is really Linux Kernel is taken the physical memory for buffering and not
releasing in back ?
If yes , how long it will hold ?

It will hold it as long as it can, its only we're low on memory that
memory is freed, There is a way to release this memory (but note that
dirty pages cannot be freed before they are written back to their
backing devices)

from Documentation/sysctl/vm.txt
==============================================================

drop_caches

Writing to this will cause the kernel to drop clean caches, dentries and
inodes from memory, causing that memory to become free.

To free pagecache:
       echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
       echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
       echo 3 > /proc/sys/vm/drop_caches

As this is a non-destructive operation and dirty objects are not freeable, the
user should run `sync' first.

==============================================================

HTH
-Joel

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



The *top* command did not showing any increase of process memory usage.
But the *free* command output showing memory usage increasing for every 2 hours.

As *top* command is not showing any increase memory statistics , Can I assume that my process is not taking any memory which is allocated using *malloc* like API? one more question , the memory allocated through malloc/new in a process should definitely released back right? But the memory reserved by kernel for buffering while a particular process is running might not be released back upon that process termination ?

Do please somebody clarify the above questions


Thanks & Regards,
Ravikumar


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux