|Bill Allombert on Mon, 10 Jul 2017 15:17:19 +0200|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|Re: gcopy_avma() is wasting stack memory compared to gcopy()|
On Wed, Jul 05, 2017 at 06:44:33PM +0200, Bill Allombert wrote: > > gcopy_avma is needed for pthread.c, but not with this semantic, since > > the threads share the universal constants, but not the same PARI stack. > > I have just found that gcopy_avma in pthread.c was causing problem > because it does not handle stack overflow. > > ? default(threadsize,"1M") > ? my(P=polmodular(101));pareval(vector(10,i,()->P*Mod(1,101))) > *** polmodular: Warning: increasing stack size to 16000000. > *** polmodular: Warning: increasing stack size to 32000000. > *** Warning: increasing stack size to 64000000. > *** at top-level: my(P=polmodular(101));pareval(vector(10,i,()-> > *** ^------------------------ > *** pareval: bug in PARI/GP (Segmentation Fault), please report. > > So we need something better. I have fixed this problem by switching the stack and using regular gcopy. This is a bit ugly, but this handles stack overflow correctly. For that reason, I find gcopy_avma rather dangerous to use. Maybe we should replace it by a function that handle stack overflow correctly. Cheers, Bill.