Karim BELABAS on Wed, 19 Mar 2003 17:56:37 +0100 (MET)


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

Re: Another memory leak in Pari/GP 2.2.5


On Tue, 18 Mar 2003, Justin Walker wrote:
> On Tuesday, Mar 18, 2003, at 10:41 US/Pacific, Alexander Shumakovitch
> wrote:
>> I guess I've found a memory leak in Pari 2.2.5 (on Linux 2.4.20). Here
>> is how to reproduce it:
>>   (19:36) gp > x = vector(2); y = vectorv(2);
>>   time = 0 ms.
>>   (19:36) gp > m = matrix(2,2); m[2, ] = x; m[, 2] = y; getheap
>>   time = 0 ms.
>>   %2 = [7, 77]
> [snip]
>> The histsize is set to 1, so history is not an issue. What is
>> interesting is that if one switches the assignments or skips one of
>> them, everything goes back to normal:
> [snip]
>
> I don't see quite the same behavior:
> ? m = matrix(2,2); m[, 2] = y; m[2, ] = x; getheap
> time = 0 ms.
> %18 = [107, 655]
> ? getheap             \\ A number of 'getheap's in a row, no other
> commands...
> time = 0 ms.
> %25 = [114, 746]

Alexander is right: if 'histsize' is set to 1, the number of objects in heap
should not vary, provided no new variable is created. You probably forgot to

  default(histsize, 1)

before trying to reproduce his example.

There was indeed a memory leak, which is fixed in CVS.

    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              http://www.math.u-psud.fr/~belabas/
F-91405 Orsay (France)            http://www.parigp-home.de/  [PARI/GP]