Re: Heap memory is not re-claiming.

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

 



On Sat, Oct 15, 2011 at 9:31 AM, Mulyadi Santosa <mulyadi.santosa@xxxxxxxxx> wrote:
Hi.... :)

On Fri, Oct 14, 2011 at 16:15, pankaj singh <psingh.ait@xxxxxxxxx> wrote:
> Nice doc ...:)
>
> On Fri, Oct 14, 2011 at 10:28 AM, rohan puri <rohan.puri15@xxxxxxxxx> wrote:
>> Reference to an article by Mulayadi Santosa :-
>>
>> http://linuxdevcenter.com/pub/a/linux/2006/11/30/linux-out-of-memory.html
>>
>> AWESOME ARTICLE SIR :)


Thank you, thank you very much for your appreciation :) I just hope,
besides getting adequate money, you all got something meaningful from
that article. And I believe, as long as there are people who have same
concerned, that article will be refined over and over and overall will
be better through the time :)

--
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

 Hi,

It's really a fabulous article.
Many many thanks to  Mulyadi for such a great article and thank for Rohan for sharing the link.

I read the article and correlate contents  with my current issue.
Here are my observations. Do please correct me if I'm wrong at any point.
 
The leak  which I was observed in my program is due to big memory buffers of size 5MB allocation from heap.I've 6 such character buffers.

So as per below lines from the article memory should be allocated with mmap and it immediately releases memory to kernel  upon free/delete call from user land process.

The allocator uses two functions to get a chunk of memory from the kernel:

The decision on whether to use brk() or mmap() requires one simple check. If the request is equal or larger than M_MMAP_THRESHOLD, the allocator uses mmap(). If it is smaller, the allocator calls brk(). By default, M_MMAP_THRESHOLD is 128KB

But It seems I'm landed with a case which uses brk() for allocation and so it just marks as free when I my program frees the memory and hence 30 MB memory (I've 6 , 5MB buffers from heap)was kept on allocator's control leading to a 30MB leak of user land process.
Please note that I'm freeing memory for 6 buffers (I'm sure about that).

Regards,
Ravi


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[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