[Date Prev][Date Next]
Re: malloc: Cannot allocate memory
--On Wednesday, November 02, 2005 8:15 PM -0500 Dusty Doris
With openldap 2.3 in production for several weeks now, I experienced my
first crash of slapd today. I have my loglevel at 256 and was able to
find this in the logs.
Started with a bunch of these:
Nov 2 18:00:41 ldap1 slapd: bdb(dc=fuse,dc=net): malloc: Cannot
allocate memory: 377
Finally ended with:
Nov 2 18:00:41 ldap1 slapd: ch_calloc of 1 elems of 392 bytes
I've received this error when slapd was unable to allocate memory (usually
by there being no free memory left on the system). This could well be
caused by faulty memory chips...
Now that I think about it, that 100,000/300,000 might be a bit high.
What do you think? Could that cause the memory error? I'm not sure if
this cache is related to the cachesize in DB_CONFIG - I'm assuming this
uses extra memory outside the DB_CONFIG size. Is that correct?
Yes, it uses extra memory outside of DB_CONFIG.
My DB_CONFIG file has the following:
set_cachesize 0 536870912 1
Since I've got 2G of RAM, I could up that 512M cachesize higher if needed
and mayble lower the cachesize in slapd.conf. Do you think that would
Here is top, sorted by res about an hour after the restart:
Mem: 217M Active, 1051M Inact, 164M Wired, 80M Cache, 112M Buf, 492M Free
Swap: 1024M Total, 1024M Free
PID USERNAME PRI NICE SIZE RES STATE C TIME WCPU CPU
33669 ldap 20 0 756M 395M kserel 0 0:25 0.00% 0.00% slapd
This shows that slapd is only taking up 395MB of your free memory, which
isn't a whole lot.
When you get a chance to experiment, what I would do is set up a server
that's identical, and then run a script to load your entire database up
into cache (just an ldapsearch across every entry via objectclass=* or
something should do...).
That should give you an idea of your maximum memory usage.
I personally run a script on my directory servers that monitors total
memory usage, and pages me when it gets too high. This was more a problem
in the mid-2.2 releases when there were many memory leaks than in later
releases. You may want to consider something similar. A basic concept
script is on my website
the monitoring section.
Principal Software Developer
GnuPG Public Key: http://www.stanford.edu/~quanah/pgp.html
"These censorship operations against schools and libraries are stronger
than ever in the present religio-political climate. They often focus on
fantasy and sf books, which foster that deadly enemy to bigotry and blind
faith, the imagination." -- Ursula K. Le Guin