mp_set_memory_functions

Minh Nguyen md6nguyen@yahoo.com
Mon, 3 Mar 2003 14:34:33 -0800 (PST)


--0-2142609244-1046730873=:18655
Content-Type: text/plain; charset=us-ascii


Hi, I am trying to create custom allocation functions as follows

 mp_set_memory_functions(myAlloc, myRealloc, myFree);

Where myAlloc, myRealloc, and myFree are just wrappers of malloc, realloc, and free (for testing purpose)

I then try a simple example to see if it works

mpz_t n;

mpz_init(n);

mpz_ui_pow_ui(n, 10, 108);

I run the code in a debugger. What surprises me is that the code never stops in myAlloc. How could this happen? The document states that the custom functions will be used for all memory allocation done by GMP. Does anyone know why?

Thanks, 

Minh

 



---------------------------------
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, and more
--0-2142609244-1046730873=:18655
Content-Type: text/html; charset=us-ascii

<P>Hi, I am trying to create custom allocation functions&nbsp;as follows</P>
<P>&nbsp;mp_set_memory_functions(myAlloc, myRealloc, myFree);</P>
<P>Where myAlloc, myRealloc, and myFree are just wrappers of malloc, realloc, and free (for testing purpose)</P>
<P>I then try a simple example to see if it works</P>
<P>mpz_t n;</P>
<P>mpz_init(n);</P><FONT size=2>
<P>mpz_ui_pow_ui(n, 10, 108);</FONT></P>
<P>I run the code in a debugger. What surprises me&nbsp;is that the code never&nbsp;stops in myAlloc. How could this happen? The document states that the custom functions will be used for all memory allocation done by GMP. Does anyone know why?</P>
<P>Thanks, </P>
<P>Minh</P>
<P>&nbsp;</P><p><br><hr size=1>Do you Yahoo!?<br>
<a href="http://rd.yahoo.com/finance/mailtagline/*http://taxes.yahoo.com/">Yahoo! Tax Center</a> - forms, calculators, tips, and more
--0-2142609244-1046730873=:18655--