Two items:

for i:1 thru 100 do integrate(cos(x),x);  in Maxima
took 0.0100 seconds on my intel 3GHz system.  so the time in maxima
for the computation is down around 0.1 ms.
I thought maybe the time is taken for parsing.
for i:1 thru 100 do parse_string("integrate(cos(x),x)");
takes about 0.0200 seconds. Still doesn't explain why you take 10X
more...

also
for i:1 thru 100 do integrate(cos(x^2),x);
takes 1.19 sec, or   about 11.9 ms rather than 31, something like 3X
more..

Maybe you could try this to see what is being spent in Maxima...

(timer(integrate), for i:1 thru 100 do integrate(cos(x),x),
timer_info());
....

The other item:  kill(foo)  does not reclaim the storage taken by foo.
It removes pointers to various properties of foo, including function
definition and value.
But the storage will not be reclaimed until the next garbage
collection,
and then only if that storage that is not still used by something
else.

Almost all lisps, but maybe not ECL? support some form of weak
pointers.
I gather from this paper
http://www.haible.de/bruno/papers/cs/weak/WeakDatastructures-writeup.html
that, as of a few years ago, this facility in python was not too
useful.

RJF


On Feb 8, 10:43 pm, Nils Bruin <[email protected]> wrote:
> On Feb 8, 10:22 pm, William Stein <[email protected]> wrote:
>
> > Yes it does.
>
> Sorry for slandering the expect interface. I noticed that the expect
> interface has a facility for reusing variables and that the maxima
> expect interface doesn't use it. But you show that deletion does
> happen, so no memorial benefit should be expected then.
>
> > > It still uses the string-
> > > based interface to bootstrap its translation dictionaries and for sage
> > > types it doesn't have its own translation methods for, though, so some
> > > memory is lost there.
>
> > Lost or used?  I.e., is this a memory leak or just that some memory is used.
>
> Used in its world, but one could construct leaks this way. When one
> has var("x") and, then the corresponding object in maxima is
> xm=EclObject("%X"). The system creates dictionary entries {x : xm} and
> {xm : x}. If one deletes x later on, the dictionary entries remain.
> After all, there could still be a maxima object lingering somewhere
> that can be converted to SR and hence recreate an instance x (i.e., x
> still has a reference: via a maxima object).
>
> Someone who knows how weakrefs work might be able to come up with a
> solution that works by ignoring these via-maxima links.
>
> The following would probably wreak havoc:
>
> i=1
> while true:
>     v=var("xx"+str(i))
>     integrate(cos(v),v)
>     delete xx+str(i) #whatever the appropriate clause is
>     i=i+1

-- 
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to