[elephant-devel] Cannot allocate memory
Walter C. Pelissero
walter at pelissero.de
Sun Feb 27 11:45:27 UTC 2005
Ben writes:
> I've commited the new changes. Walter -- can you try your tests with
> the new stuff? (you'll need to upgrade to sleepycat 4.3, and do a
> fresh cvs checkout.)
I downloaded the latest elephant and installed db-4.3. The problem
didn't go away but I've been able to isolate it. My program, in
certain situations, starts a complete scan of the database (summing
the value of a class slot). This is done within a transaction that
somehow exausts Sleepycat resources. Here is how to reproduce the
problem.
I run several times the following function with increasing START
values. (Just iterating more times in the loop would trigger the DB
error, so I tried to avoid it.)
(defun load-elephant (start)
(be btree (ensure-btree "test")
(ele:with-transaction ()
(loop
with end = (+ start 100000)
for i from start by 1 below end
do (setf (ele:get-value i btree) i)))))
After having, say, one million items, I run the following function,
which doesn't do anything special beside counting the items in the
btree.
(defun crash-elephant ()
(ele:with-transaction ()
(elephant:with-btree-cursor (btree (ensure-btree "test"))
(loop
with items = 0
for (ok key value) = (multiple-value-list (ele:cursor-first btree))
then (multiple-value-list (ele:cursor-next btree))
while ok
do (incf items)
finally (return items)))))
This should yield the DB error.
--
walter pelissero
http://www.pelissero.de
More information about the elephant-devel
mailing list