From d7930d7f820e5dd6b07b823f155aeb943b525e16 Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Wed, 14 Jul 2010 14:19:16 +1000 Subject: [PATCH] Use driver allocators in expat for reflecting memory in erlang:memory(system) --- src/expat_erl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/expat_erl.c b/src/expat_erl.c index 8727e5172..f6b552c59 100644 --- a/src/expat_erl.c +++ b/src/expat_erl.c @@ -41,6 +41,8 @@ typedef struct { XML_Parser parser; } expat_data; +static XML_Memory_Handling_Suite ms = {driver_alloc, driver_realloc, driver_free}; + void *erlXML_StartElementHandler(expat_data *d, const XML_Char *name, const XML_Char **atts) @@ -98,7 +100,7 @@ static ErlDrvData expat_erl_start(ErlDrvPort port, char *buff) { expat_data* d = (expat_data*)driver_alloc(sizeof(expat_data)); d->port = port; - d->parser = XML_ParserCreate("UTF-8"); + d->parser = XML_ParserCreate_MM("UTF-8", &ms, NULL); XML_SetUserData(d->parser, d); set_port_control_flags(port, PORT_CONTROL_FLAG_BINARY);