Re: Out of memory vs memory leak

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

 



On Don, 2010-01-07 at 20:34 +0530, Anand Raj Manickam wrote:
> I have a few doubts regarding Out of Memory  .
> 
> 1.Does memory leak in the kernel always lead to OOM ?
If the leaking code is occasionally used, it's just a question of time.

> 2. I wrote a kernel  test module testing the memory leak , which on
> exit kmallocs
> 
> exit_module ()
> {
>    while(1)
>    kmalloc((8*1024),GFP_KERNEL);
> }
> 
> so when i rmmod test , the kernel never panicked on OOM , but it
> panicked on the page allocation stat (sorry for not attaching the
> dump)
Here you have the out-of-memory situation.

> Does the kernel differentiate between a Memory Leak and a Out of
> memory situation ?
> 
> Google didnt help me in the releation between memory leak and OOM .
OOM (as used above) usually occurs if the userspace runs out of memory
(or one process or ...).
Memory management within the kernel is somewhat different because: If a
user process hits memory limits (or the systems memory runs out), that
process can (usually) be killed - just like a `kill -9` from user space
-  and it's resources are freed. And the kernel can do this as he knows
everything of a user space process.
If kmalloc() in some kernel module (or core code) fails, that module
must cleanup and/or decide what to do (or the host will eventually
panic) - and such a module is plain simply buggy BTW.
Possible actions are e.g. failing sys-calls or the like.

	Bernd
-- 
mobil: +43 664 4416156          http://bernd.petrovitsch.priv.at/
    Linux Software Entwicklung, Beratung und Dienstleistungen


--
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