Re: Out of memory vs memory leak

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

 



Hi...

I saw that others had replied your questions with good answers, so
probably I just add something...

On Thu, Jan 7, 2010 at 10:04 PM, Anand Raj Manickam <anandrm@xxxxxxxxx> wrote:
> I have a few doubts regarding Out of Memory  .
>
> 1.Does memory leak in the kernel always lead to OOM ?

sooner or later yes. And kernel won't get OOM-ed...it will simply
continously leaking if the code is buggy until it stop by itself. Or
the kernel no longer has free memory pages available from all zones. I
think, in the worst case scenario, it will silently crash the kernel.

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

sorry, what do you mean by "page allocation stat"?

> Does the kernel differentiate between a Memory Leak and a Out of
> memory situation ?

IMHO it's not about whether we see it from kernel or user space
perspective. It's about each of their meaning.

Memory leak is a condition where allocation happens but reclaim
doesn't happen at the same amount of allocation, thus there is an
(growing) amount of stale memory.

While OOM refers to a condition where allocator no longer able to find
and assign free memory page for the requester, whether it comes from
free directly memory pool or by previously flush page cache.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

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