| Karim Belabas on Thu, 30 Mar 2006 20:23:58 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: Segmentation fault during output() |
* Chris Condrat [2006-03-14 06:08]:
> I'm using a CATCH(errpile) {} TRY {} ENDCATCH; block to capture stack
> overflows and dump the last-known-good output to a file, before
> resetting the avma and starting again. The flow of the program is much
> like:
>
> loop
> {
> CATCH (errpile)
> {
> avma = last_known_good_avma;
> output(last_known_good_formula);
> avma = top_of_the_stack;
> // Get ready to start again.
> CATCH_RELEASE();
> } TRY {
> // computations with garbage collecting which will probably overflow.
> } ENDCATCH;
> } while(still_more_to_do);
>
>
> This works great for the first four or so runs (that is, overflows),
> but on the fifth run, it segmentation faults while attempting to write
> the GEN to the output. I have narrowed it down specifically to when
> it tries to output the GEN.
>
> Am I doing something wrong here? Any suggestions would be appreciated as well.
I'm not sure. If a stack overflow occurs during
'output(last_known_good_formula)', we're in trouble.
Doesn't "random GC" [ using if (low_stack()) constructs ] address your
problem with less hassle ?
In doubt, feel free to send me your code, I'll have a look.
(And possibly post whatever solution I could come with if this
turns out to be of general interest.)
Cheers,
K.B.
--
Karim Belabas Tel: (+33) (0)5 40 00 26 17
Universite Bordeaux 1 Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation http://www.math.u-bordeaux.fr/~belabas/
F-33405 Talence (France) http://pari.math.u-bordeaux.fr/ [PARI/GP]