Do NOT use ndbm.
That is certainly your problem. I'm starting to regret we ever
added support for it, and I'm certainly regretting that we didn't
include some larger warnings in the documentation about ndbm's
heinously limited characteristics, though we did include a
warning. This is by far the number one problem people seem to
be having. Solaris is particularly bad here, since its block size
(in which a single key/data pair must fit) is only 1024 bytes.
Pathetic.
Try it with gdbm or better yet berkeley db and see if that
doesn't solve your problem. -- Tim