[xml] libxml2 memory management and iconv



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.
3. libxml2's memory management design is not broken; there's something else I'm failing to understand.

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?

If #3 is the case, what am I missing?

Thanks,
Tim


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