Add a malloc_trim() call when deallocating the parser in mh_xslt. Seems to help with memory fragmentation, reason a bit mysterious
This commit is contained in:
parent
c4fc68b934
commit
9e05c167e9
@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
#include "autoconfig.h"
|
#include "autoconfig.h"
|
||||||
|
|
||||||
|
#include <malloc.h>
|
||||||
|
|
||||||
#include <libxml/parser.h>
|
#include <libxml/parser.h>
|
||||||
#include <libxml/tree.h>
|
#include <libxml/tree.h>
|
||||||
#include <libxslt/transform.h>
|
#include <libxslt/transform.h>
|
||||||
@ -45,6 +47,12 @@ public:
|
|||||||
virtual ~FileScanXML() {
|
virtual ~FileScanXML() {
|
||||||
if (ctxt) {
|
if (ctxt) {
|
||||||
xmlFreeParserCtxt(ctxt);
|
xmlFreeParserCtxt(ctxt);
|
||||||
|
// This should not be necessary (done by free), but see
|
||||||
|
// http://xmlsoft.org/xmlmem.html#Compacting The
|
||||||
|
// malloc_trim() and mallopt() doc seems to be a bit
|
||||||
|
// misleading, there is probably a frag size under which
|
||||||
|
// free() does not try to malloc_trim() at all
|
||||||
|
malloc_trim(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user