[redland-dev] Memory allocation in generate_id_handler

Jasper van de Gronde th.v.d.gronde at hccnet.nl
Thu Jun 24 11:25:34 BST 2004


I use a generate_id_handler in my application (I'm talking about 
Raptor), which has to allocate some memory for the string it returns. 
Now my question is how I am supposed to do this. Currently I just use 
malloc as I traced to where the string got freed and saw it was freed by 
free (seems sensible).

As I'm linking statically to raptor this doesn't present much of a 
problem, but if I was to link dynamically to raptor this would most 
likely cause problems (on Win32 at least, as the dll's don't - have to? 
- share the same instance of the runtime library), at least that's how I 
understand it (and that's what has given me quite a few problems in the 
past, with other libraries).

Am I overlooking something? On Win32 this could be solved by simply 
adding a raptor_alloc_function or letting the user of the library free 
the memory in some way (the module that allocates the memory should also 
free it).



More information about the redland-dev mailing list