Hi,
I've been using newest libxml2 (2.6.19) and this problem work also in
2.6.17. Problem is that libxml2 uses so much memory. I one creates XML
document that contains like 10000 tags and 150 sub tags per parent node
(see code example) memory usage is like 235 megs (tells top) but rendered
xml file is only 24 megs.. should this be like this?
Thanks,
Tuukka
test code:
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include <stdio.h>
int main(void) {
xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0");
int j = 0;
int i = 0;
char string[150];
if( doc == NULL ){
printf("Can't create doc\r\n");
exit -1;
}
xmlDocSetRootElement( doc, xmlNewNode(NULL, "test") );
xmlNodePtr root = xmlDocGetRootElement( doc );
xmlNodePtr test = NULL;
for(j = 1; j < 10000; j ++ ){
sprintf(string, BAD_CAST "work" );
test = xmlNewTextChild(root, NULL, string, BAD_CAST "nou");
for( i = 0; i < 150; i ++ ){
sprintf(string, BAD_CAST "samba-%d", i );
xmlNewTextChild(test, NULL, string, BAD_CAST "jes");
}
}
xmlSaveFormatFileEnc("test.xml", doc, "utf-8", 1);
xmlFreeDoc(doc);
xmlCleanupParser();
}
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml