Loic Grenie on Mon, 13 Nov 2006 17:17:06 +0100


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

Strange cgetg in smallvectors


    I've found a cgetg which, I think, might not get used. I don't know
  whether this can use a lot of memory. Namely: at line 3426 of bibli1.c
  (rev 1.311), there is a 

GEN Snew = cgetg(stockmaxnew + 1, t_VEC);

  and I think this Snew is not used if stockmaxnew != stockmax. It might be
  usefull to

    - either move the if (stockmax != stockmaxnew), below, just before
      this allocation
    - or do something similar to

GEN Snew;
Snew = (stockmax == stockmaxnew) ? S : cgetg(stockmaxnew + 1, t_VEC);

      if the if (check), immediately below, is important.

   (this could matter only if stockmax can be very large in the first place,
   otherwise it is lost in the next gerepile with next to no impact on
   performance).

      Loïc