Jan Jancar on Wed, 05 Apr 2017 23:49:25 +0200


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

Re: libpari: ellsea & ellcard caches



On 04/05/2017 10:44 PM, Bill Allombert wrote:
> On Wed, Apr 05, 2017 at 10:25:12PM +0200, Jan Jancar wrote:
>> Does ellsea use some caches or otherwise allocate memory
>> thats left after it returns? I am not getting memory leaks
>> so not that.
> 
> Yes, the computed data are stored in the ellinit so that e.g.
> ellorder does not need to recompute the curve order.
> To free them do
> obj_free(E);
> where E is the ellinit.
> Not that ellsea does not store the data in the ellinit.

Yes I know about the curve order being stored in the ellinit structure.
Now I added obj_free to the loop but:

pari_sp ltop = avma
generate random: field, a, b parameters
e = ellinit([a,b], field)
ellsea(e)
ellgenerators(e)
random(e)
obj_free(e)
avma = ltop

in a loop, still the memory usage reported goes up after many such loops.


->14.73% (384,000B) 0x518D351: pari_malloc (pariinl.h:1085)
| ->14.73% (384,000B) 0x5190097: init_GRHcheck (buch2.c:444)
|   ->14.73% (384,000B) 0x518A65B: Buchquad (buch1.c:1000)
|     ->14.73% (384,000B) 0x518B552: quadclassunit0 (buch1.c:1176)
|       ->14.73% (384,000B) 0x537FF47: classno_wrapper (polclass.c:976)
|         ->14.73% (384,000B) 0x538262C: polclass0 (polclass.c:1683)
|           ->14.73% (384,000B) 0x538C2EA: polmodular0_ZM (polmodular.c:2175)
|             ->14.73% (384,000B) 0x538C7F7: polmodular_ZM (polmodular.c:2237)
|             | ->14.73% (384,000B) 0x538C846: polmodular_ZXX (polmodular.c:2248)
|             |   ->14.73% (384,000B) 0x51FF45D: get_modular_eqn (ellsea.c:122)
|             |     ->14.73% (384,000B) 0x5207F44: find_trace (ellsea.c:1353)
|             |       ->14.73% (384,000B) 0x520AC08: Fq_ellcard_SEA (ellsea.c:1882)
|             |         ->14.73% (384,000B) 0x520B1CC: Fp_ellcard_SEA (ellsea.c:1951)
|             |           ->14.73% (384,000B) 0x525EA2B: Fp_ellcard (FpE.c:1205)
|             |             ->14.73% (384,000B) 0x51EAAEA: doellcard (elliptic.c:4881)
|             |               ->14.73% (384,000B) 0x547DBFB: obj_checkbuild (init.c:2109)
|             |                 ->14.73% (384,000B) 0x51F25B0: ellff_get_card (elliptic.c:6604)


or

| | | ->09.59% (250,056B) 0x51FF68F: divpol_f2 (ellsea.c:158)
| | | | ->03.36% (87,728B) 0x5200A9D: Fq_ellyn (ellsea.c:380)
| | | | | ->03.28% (85,408B) 0x5201F4E: Fq_find_eigen_value_power (ellsea.c:629)
| | | | | | ->03.28% (85,408B) 0x5202193: find_eigen_value_power (ellsea.c:652)
| | | | | |   ->03.14% (82,000B) 0x5207627: find_trace_Elkies_power (ellsea.c:1253)
| | | | | |   | ->03.14% (82,000B) 0x52080BF: find_trace (ellsea.c:1373)
| | | | | |   |   ->03.14% (82,000B) 0x520AC08: Fq_ellcard_SEA (ellsea.c:1882)
| | | | | |   |     ->03.14% (82,000B) 0x520B1CC: Fp_ellcard_SEA (ellsea.c:1951)
| | | | | |   |       ->03.14% (82,000B) 0x525EA2B: Fp_ellcard (FpE.c:1205)
| | | | | |   |         ->03.14% (82,000B) 0x51EAAEA: doellcard (elliptic.c:4881)
| | | | | |   |           ->03.14% (82,000B) 0x547DBFB: obj_checkbuild (init.c:2109)
| | | | | |   |             ->03.14% (82,000B) 0x51F25B0: ellff_get_card (elliptic.c:6604)

or

| | ->04.28% (111,720B) 0x538365E: cgetg_block (level1.h:147)
| | | ->03.89% (101,528B) 0x5388102: zero_block (polmodular.c:975)
| | | | ->02.07% (53,872B) 0x538816E: polmodular_db_init (polmodular.c:994)
| | | | | ->02.07% (53,872B) 0x538C7CC: polmodular_ZM (polmodular.c:2236)
| | | | |   ->02.07% (53,872B) 0x538C846: polmodular_ZXX (polmodular.c:2248)
| | | | |     ->02.07% (53,872B) 0x51FF45D: get_modular_eqn (ellsea.c:122)
| | | | |       ->02.07% (53,872B) 0x5207F44: find_trace (ellsea.c:1353)
| | | | |         ->02.07% (53,872B) 0x520AC08: Fq_ellcard_SEA (ellsea.c:1882)
| | | | |           ->02.07% (53,872B) 0x520B1CC: Fp_ellcard_SEA (ellsea.c:1951)
| | | | |             ->02.07% (53,872B) 0x525EA2B: Fp_ellcard (FpE.c:1205)
| | | | |               ->02.07% (53,872B) 0x51EAAEA: doellcard (elliptic.c:4881)
| | | | |                 ->02.07% (53,872B) 0x547DBFB: obj_checkbuild (init.c:2109)
| | | | |                   ->02.07% (53,872B) 0x51F25B0: ellff_get_card (elliptic.c:6604)


Cheers,
-- 
Jan
______________________________________________________
   /\  # PGP: 362056ADA8F2F4E421565EF87F4A448FE68F329D
  /__\  # https://neuromancer.sk
 /\  /\  # Eastern Seaboard Phishing Authority
/__\/__\  # 

Attachment: signature.asc
Description: OpenPGP digital signature