Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Nov 2004 10:54:43 -0500
From:      Chuck Swiger <cswiger@mac.com>
To:        Ivan Voras <ivoras@fer.hr>
Cc:        stable@freebsd.org
Subject:   Re: Huge slapd?
Message-ID:  <41AB4643.90807@mac.com>
In-Reply-To: <41AAF2BE.7030800@fer.hr>
References:  <41A60264.30109@fer.hr> <41AA6F6E.1080809@mac.com> <20041129004546.GA1541@k7.mavetju> <41AAF2BE.7030800@fer.hr>

next in thread | previous in thread | raw e-mail | index | archive | help
Ivan Voras wrote:
> Edwin Groothuis wrote:
>> On Sun, Nov 28, 2004 at 07:38:06PM -0500, Chuck Swiger wrote:
[ ... ]
>>>> I know that the actually used memory size is the 6MB figure above, 
>>>> but why does it allocate almost 150MB? Is it normal?
>>>
>>> This sounds like a classic example of a memory leak.
>>
>> Had the same before I moved to openldap 2.2
> 
> I should have said - this *is* openldap 2.2, from a week ago, on 5-stable.

You can work around the problem to some extent by making sure the system has 
plenty of swap space available, and/or by restarting slapd on a regular basis 
(weekly or even nightly).

However, the real solution involves identifying what is leaking and having the 
authors of LDAP fix that problem.  You can use gdb to attach to the process 
and examine memory in order to get some clues as to what is going on.  You can 
link slapd against a malloc debuuging tool like Purify or dmalloc, however, I 
would really like to see a tool for FreeBSD which resembles "leaks" under MacOS X:

1-base# leaks
syntax: leaks <pid>1 ... <pid>n
   {-exclude <symbol>}* to exclude specific symbols
With -nocontext, the hex dump of leaked memory is supressed.
If the target ran with 'setenv MallocStackLogging 1, then the call stack
leading to the allocation is shown.
With -nostacks, the call stack for the allocation is supressed.
2-base# psg zsh
root     9474   0.0  0.2    28172   1236 std  Ss   10:45AM   0:00.30 zsh
3-base# leaks 9474
Process 9474: 3703 nodes malloced for 125 KB
Process 9474: 0 leaks for 0 total leaked bytes.
4-base# psg syslogd
root       78   0.0  0.0    18092    188  ??  Ss   19Aug04  18:42.23 
/usr/sbin/syslogd -s -m 0
5-base# leaks 78
Process 78: 284 nodes malloced for 38 KB
Process 78: 232 leaks for 5568 total leaked bytes.
Leak: 0x001018f0  size=32
         0x00000000 0x00000002 0x00000002 0x00000011
         0x00000010 0x00000000 0x001018b0 0x00000000
Leak: 0x001018c0  size=32
         0x00000000 0x00000002 0x00000002 0x00000011
         0x00000010 0x00000000 0x00101880 0x00000000
[ ... ]

Is there anything like this available for FreeBSD?

-- 
-Chuck



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41AB4643.90807>