Re: [xml] libxml2 memory management and iconv

On Wed, Jan 10, 2007 at 05:59:23PM -0500, Tim Conkling wrote:
I'm interested in compiling libxml2 for a videogame console that I'm working
with (unfortunately, I'm contractually prevented from revealing the name of
the particular console in question). In order to use libxml2 properly on
this system, I need to supply it with my own memory management routines --
calling malloc is an error.

While making a build of the iconv library (I'm using the GNU iconv lib), I
noticed that the iconv_open function calls malloc (and the corresponding
function, iconv_close, calls free). libxml2 calls both of these functions.

I'm not sure that I understand the whole picture here, but it _seems_ that
libxml2 is making a promise to only use user-defined memory management
routines if they are supplied, and then breaking that promise by calling an
API that performs its own memory management.

I'm looking for help in figuring out which of these statements is true:

1. libxml2's memory management design is broken, and the library's implicit
guarantee to use user-supplied routines for memory management can't be
relied on.
2. libxml2's memory management design is not broken; instead, libxml2
assumes that a user who has specific memory management requirements will
provide a version of the iconv API that meets these requirements.

  That one. Just compile without iconv supprt. Of course only a limited subset
of encodings will be supported, the XML-1.0 spec requires only UTF-8 and 
UTF-16, libxml2 also handle the ISO Latin x ones too natively. Read

If #2 is the case, are there other external functions that libxml2 calls
that may allocate their own memory, and that I should therefore supply my
own implementation for?

  Not that I know of.


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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