[elephant-devel] Cannot allocate memory

Ben ben at medianstrip.net
Mon Feb 28 06:28:42 UTC 2005


Have you tried using degree-2 cursors / transactions on your read?
sleepycat by default uses serializable cursors / transactions.  this
means that during the course of a read you're guaranteed that the
stuff you've seen won't change.  this, as you can imagine, requires a
lot of locks.  degree-2 relaxes that condition, you might consider it.

B

On Sun, 27 Feb 2005, Walter C. Pelissero wrote:

> 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