help-libidn
[Top][All Lists]
Advanced

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

Re: No idn_free documentation


From: Sisyphus
Subject: Re: No idn_free documentation
Date: Mon, 9 Feb 2009 10:04:06 +1100


----- Original Message ----- From: "Simon Josefsson" <address@hidden>

* The theory of isolating all memory allocations and de-allocations
* within a code package (library) sounds good, to simplify hunting
* down memory allocation related problems, but I'm not sure if it is
* worth enough to motivate recommending this interface over calling
* `free' directly, though.

I hadn't read those comments in idn-free.h.

I've come across a problem with memory allocation where free() cannot be used, and idn_free() is the only solution, afaik.

With C programs, there's no issue, but when we extend perl to interface with libidn, on Win32, free() cannot be used in the XS code to free the memory that was allocated by the libidn functions. As soon as free() is called we get a "Free to wrong pool ...." fatal error. Afaik this happens only on Win32 - it definitely doesn't happen on linux.

So, on Win32, we either have to use idn_free() in the XS code, or settle for memory leakage.
(Again, that's "afaik" :-)

I think that idn_free() should be documented in libidn.info (and other pertinent places) so that people can readily find it when free() has become unusable. And the advice in the documentation, that the memory should be freed using free(), should also at least mention the option of using idn_free().

Are there any known cases where idn_free() breaks something that's not broken by free() ?

Thanks for the reply, Simon.

Cheers,
Rob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]