Karim BELABAS on Wed, 15 Jan 2003 16:13:24 +0100 (MET)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: qflllgram() infinite loop


On Mon, 13 Jan 2003, Igor Schein wrote:
> On Fri, Jan 10, 2003 at 12:59:49AM +0100, Karim BELABAS wrote:
>> On Wed, 8 Jan 2003, Igor Schein wrote:
>>> qflllgram(matid(229))
>>>
>>> never finishes at 4MB stack.
>>>
>>> Last time it worked was Nov 9 2002.
>>>
>>> If I double the stack, it works fine.
>>
>> Not an infinite loop, intensive (and almost hopeless) garbage collection.
>> You're operating in huge dimension and very small space, so that 99.99% of
>> the running time is spent in desperation GC.
>>
>> I have reduced memory use for such very sparse matrices, so the above is
>> fixed. But the same phenomenon is likely to occur again, in larger
>> dimensions.
>
> In fact it does, for qflll(matid(350)).  How come most of other commands
> detect low stack space and ask to double the stack, and this one is
> not able to?

Because it doesn't do anything! It simply notices that available stack space
is very low, so that we'd be running out of space _assuming_ we do something
non-trivial. So it does a full garbage collection anytime it gets a chance;
all in vain of course. Stack doesn't overflow since we don't do anything
and no GEN objects are being created.

In short: there's nothing PARI can do, given the current memory model [ which
is IMHO sometimes annoying, but more useful than automagically allocating
further memory until the machine swaps itself into oblivion ].

I _could_ add heuristics to stop "random garbage collections" if not enough
memory is recovered, but that would be painful, dangerous, and mostly
pointless:

1) If you want to handle huge problems, allocate enough memory.
2) If you don't know what "enough" is, guess, set \gm 2, and react accordingly.

This is not user-friendly, but it doesn't happily overload the machine as
most other systems would.

    Karim.
-- 
Karim Belabas                    Tel: (+33) (0)1 69 15 57 48
Dép. de Mathématiques, Bât. 425  Fax: (+33) (0)1 69 15 60 19
Université Paris-Sud             Email: Karim.Belabas@math.u-psud.fr
F-91405 Orsay (France)           http://www.math.u-psud.fr/~belabas/
--
PARI/GP Home Page: http://www.parigp-home.de/