From: Daniel Veillard (Daniel.Veillard@imag.fr)
Date: Thu Feb 08 2001 - 04:35:52 EST
On Thu, Feb 08, 2001 at 06:48:57AM +0000, Gary Pennington wrote:
>
> Hi Daniel,
>
> I was in too much of an hurry last night.
>
> My patch introduces a memory leak. A better patch would be to always update the
> hash table with the latest update (just in case something further up the call
> stack expects the hash table to contain our data) and free the existing
> reference.
Right,
> ! * Since there is no discrimination on error returns
> ! * from xmlHashAddEntry, I'm presuming <0 means the
> ! * key already exists.
> ! */
> ! xmlHashUpdateEntry(table, value, ret, (xmlHashDeallocator)
> xmlFreeRef);
Right, what you actually do with this code is keep a single ref (the last
one in document order). It's not good but better than a leak !
> I worked out how to use the arity 2 hash functions, but they didn't solve the
> problem since I couldn't work out a unique key for a reference using any of the
> data in the data structures (I really needed a unique element identifier, but
> since there is no such thing that won't work.). Anyway, the more I thought about
> it, the more I thought that a list of entries stored at the hash for the ref key
> was the right approach.
Hum, right !
> If people agree with my comments above, then I'd be happy to implement a list
> based ref approach which provides a new function :-
>
> xmlGetRefs (returns a list of refs for a key)
>
> and which allows multiple refs to be stored under a single key. I'd be
> introducing a linked list data structure for holding the refs and would also
> provide some functions for walking the list, etc...
Yes please ! shouldn't be too hard,
I suggest you use the xmlNodeSetPtr structure (only trouble is that
it's dependant on XPath code right now, but i can fix that), rather than
rebuild a list based new set of APIs.
Daniel
-- Daniel Veillard | Red Hat Network http://redhat.com/products/network/ veillard@redhat.com | libxml Gnome XML toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ ---- Message from the list xml@rpmfind.net Archived at : http://xmlsoft.org/messages/ to unsubscribe: echo "unsubscribe xml" | mail majordomo@rpmfind.net
This archive was generated by hypermail 2b29 : Thu Feb 08 2001 - 04:44:42 EST