On Aug 22, 2:16 pm, William Stein <wst...@gmail.com> wrote:

> Nils -- why don't you build everything in your (presumed) account on
> sage.math.washington.edu?  Then you can easily given Juanjo access to that,
> since he also has an account on sage.math.washington.edu.

Done. The following is now available on sage.math:

/scratch/nbruin/sage-4.1.1-ecl/    --- a working sage tree with an ecl-
library extension
/home/nbruin/sage-4.1.1-ecl-x86_64-Linux.tar.gz  --- the above tree "-
bdist"-ed
/home/nbruin/ecl-crash.sage  ---- a script to effect the crash
/home/nbruin/use-ecl-maxima.sage ---- a script demoing interfacing
with maxima

the crash is completely predictable and reproducible. This does the
trick:
/scratch/nbruin/sage-4.1.1-ecl/sage < /home/nbruin/ecl-crash.sage

I'm looking forward to any insights people might have.

In fact, I think I already know the cause of the error: the GMP
library does have some global state in the form of
mp_set_memory_functions. cl_boot does call that via init_number to set
ECLs memory allocation routines.
Of course, sage uses GMP as well, and allocates some integers right
from the start.

So it's no surprise at all that integer_free_integer_pool seems to
call ecl_dealloc, because it does (via some gmp macro for deallocating
a gmp integer), and since that integer was allocated by another memory
manager, a segfault is entirely expected.

I think this is a complete showstopper for including ecl as a library.
Should we call mp_set_memory_functions before and after each call to
ecl? And then just be very hygienic about which gmp integer goes
where?
Not letting ecl set its memory management for gmp would not be an
option, because only ecl knows if the memory can be freed.

I thought the fact that ecl also using gmp would make it very
compatible with sage. Turns out it's a major stumbling block.

---
Concerning the safe-eval:

Ah, of course. You are just catching the error on lisp-level. Now I
can write my own error handler if that's necessary.

Concerning signals:

Is it necessary for ECL to be notified of signals? I think it's good
if sage gets them, so "sigaction" might be the better way to go.


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to