To avoid memory leaks, at the end of routines that use mpz/mpq/mpf
vars I want to free the ones that have been initialized, but not the
ones that haven't. I would greatly prefer to do this at the end
rather than track each var's status throughout the code.
In C, I declare a var as (say)
MP_INT mpzVar = {0};
so the var starts out with all zero elements. When a var is
initialized and later cleared, the internals don't seem to change
sufficiently when cleared for me to be able to distinguish that case.
Q1: Is there some simple way to tell by looking at a var's internals
to see whether it has been clear'ed?
Q2: When a var is cleared, is it OK for me to zero the _mp_d ptr so I
can test that element?
Also, to track memory leaks I use Custom Allocation functions, so I
would prefer not to free a var that's already been freed as it won't
be found in the table of memory allocations and it'll be harder to
distinguish that case from a bug in my code.
--
You received this message because you are subscribed to the Google Groups
"mpir-devel" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/mpir-devel?hl=en.