/* * We need to trap calls to the resolver to not account memory for the catalog * which is shared to the current running test. We also don't want to have * network downloads modifying tests. */ static xmlParserInputPtr testExternalEntityLoader(const char *URL, const char *ID, xmlParserCtxtPtr ctxt) { xmlParserInputPtr ret; int i; for (i = 0;i < nb_entities;i++) { if (!strcmp(testEntitiesName[i], URL)) { ret = xmlNewStringInputStream(ctxt, (const xmlChar *) testEntitiesValue[i]); if (ret != NULL) { ret->filename = (const char *) xmlStrdup((xmlChar *)testEntitiesName[i]); } return(ret); } } if (checkTestFile(URL)) { ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt); } else { int memused = xmlMemUsed(); ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt); extraMemoryFromResolver += xmlMemUsed() - memused; } #if 0 if (ret == NULL) { fprintf(stderr, "Failed to find resource %s\n", URL); } #endif return(ret); }
/* * We need to trap calls to the resolver to not account memory for the catalog * which is shared to the current running test. We also don't want to have * network downloads modifying tests. */ static xmlParserInputPtr testExternalEntityLoader(const char *URL, const char *ID, xmlParserCtxtPtr ctxt) { xmlParserInputPtr ret; int memused = xmlMemUsed(); ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt); extraMemoryFromResolver += xmlMemUsed() - memused; return(ret); }
/* * call-seq: * XML.memory_used -> num_bytes * * Perform a parser memory dump (requires memory debugging * support in libxml). */ static VALUE rxml_memory_used(VALUE self) { #ifdef DEBUG_MEMORY_LOCATION return(INT2NUM(xmlMemUsed())); #else rb_warn("libxml was compiled without memory debugging support"); return (Qfalse); #endif }