I have used libxml2 since it was libxml so I can’t believe I am having this problem. I’m looking for someone smarter than me to help out. I use only the DOM (memory) parser, and an old version at that: libxml2-2.7.3 I have a program that makes many XML files. They, alone, are not a problem. But when a large amount are made (100s) it gets a memory error. After each XML document I make I write them to disk and then free them (meaning I thought I was freeing ALL the memory). This is not the case so I assume I am not coding it correctly. This is what I am doing … The node is passed to this function (xmlNodePtr) named freeMe(xmlNsPtr node) Void freeMe(xmlNSPtr node) { xmlNsPtr next; xmlNsPtr cur; cur = node->ns; while (cur) { next = cur->next; if (cur->href) xmlFree((char *) cur->href); if (cur->prefix) xmlFree((char *) cur->prefix); cur->href = "" cur->prefix = NULL; xmlFree((char *)cur); cur = next; } node->ns = NULL; if (node->type == XML_ELEMENT_NODE || node->type == XML_XINCLUDE_START || node->type == XML_XINCLUDE_END) { cur = node->nsDef; while (cur) { next = cur->next; if (cur->href) xmlFree((char *) cur->href); if (cur->prefix) xmlFree((char *) cur->prefix cur->href = "" cur->prefix = NULL; xmlFree((char *)cur); cur = next; } node->nsDef = NULL; If (node->children) FreeMe(node->children); //recursive } xmlFreeDoc(node); //done I think freeing up all memory I LEFT out the tests for NULLS and error checking and other silly things so it would not be too long. It also repeats mostly the exact same code if the node is NS so I won’t bore you. Don’t use NS much anyway. Problem is, something is not free()’d up. So besides the main node and NS is there something else I have to free()? Better, is there a function that I can pass the node and it free()’s everything for me? Any help – even sample code – would be much appreciated! Free horse back ride in AZ for a winner? E Eric S Eberhard VICS (Vertical Integrated Computer Systems) Voice: 928 567 3529 Cell : 928 301 7537 (not reliable except for text or if not home) 2933 W Middle Verde Rd Camp Verde, AZ 86322 Oh – help me out and please join this group. I need to get large numbers of members to take to the politicians. https://www.facebook.com/groups/286143052248115/ |