strange memory leak (in ldb?)

Stefan (metze) Metzmacher metze at samba.org
Fri Nov 5 00:00:01 MDT 2010


Hi Kamen,

it seems you're right. I have a standalone tool to demonstrate it.

http://gitweb.samba.org/?p=metze/misc/junkcode.git;a=blob;f=malloc-reclaim/malloc-reclaim.c

I wonder if there's a way to avoid that memory fragmentation.
Also the heap is still there at the last mybreak().

metze

> On Thu, Nov 4, 2010 at 19:30, Stefan (metze) Metzmacher <metze at samba.org> wrote:
>> Hi Tridge,
>>
>> I noticed that we have seem to have a memory leak somewhere...
>>
>> I have the following setup a domain with ~ 20000 objects (users, groups,
>> computers).
>>
>> When I start 'samba' the heap looks fine.
>>
>> full talloc report on 'null_context' (total 1287675 bytes in 31491 blocks)
>> ...
>>
>> while the heap section is /proc/<pid>/smaps looks like this:
>>
>> 00612000-01fb4000 rw-p 00000000 00:00 0
>>  [heap]
>> Size:              26248 kB
>> Rss:               26092 kB
>> Pss:               13332 kB
>> Shared_Clean:          0 kB
>> Shared_Dirty:      25520 kB
>> Private_Clean:         0 kB
>> Private_Dirty:       572 kB
>> Referenced:        26092 kB
>> Swap:                  0 kB
>> KernelPageSize:        4 kB
>> MMUPageSize:           4 kB
>>
>> After doing an DRS-RPC-DSSYNC against samba / or letting a windows dc
>> replicate from us.
>>
>> It looks like:
>>
>> full talloc report on 'null_context' (total 1293104 bytes in 31552 blocks)
>> ... (not much different, there're small leaks I'm currently fixing)
>>
>> But the heap looks like this now:
>>
>> 00612000-20854000 rw-p 00000000 00:00 0
>>  [heap]
>> Size:             526600 kB
>> Rss:              526568 kB
>> Pss:              524624 kB
>> Shared_Clean:          0 kB
>> Shared_Dirty:       3888 kB
>> Private_Clean:         0 kB
>> Private_Dirty:    522680 kB
>> Referenced:       526568 kB
>> Swap:                  0 kB
>> KernelPageSize:        4 kB
>> MMUPageSize:           4 kB
>>
>> About 20x more than before the replication.
>>
>> I think I had something similar in our wins server, when replication a
>> large database
>> and the leak was triggered by ldb_search(), but I never figured out why.
>> Eevent valgrind's massif didn't help to track it down.
>>
>> Do you have any idea what the problem is, maybe a glibc malloc bug?
>>
> Perhaps I don't know how exactly how memory manager works under linux,
> but does it reclaims freed memory right away?
> I.e. if you make another DSSYNC test, will it increase memory usage again?
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20101105/2d9c0696/attachment.pgp>


More information about the samba-technical mailing list