gdome_di_createDocFromMemory Memory Leak

View: New views
2 Messages — Rating Filter:   Alert me  

gdome_di_createDocFromMemory Memory Leak

by Himalay Gopu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi

 

We are developing a threaded module (15 transactions per second) with gdome and we need to get the xml from memory and parse the same

 

But when we try to use gdome_di_createDocFromMemory there seems to be a memory leak almost 6144 bytes for every transaction

 

The leak starts from here

 

response_document = gdome_di_createDocFromMemory (domimpl, response.body, GDOME_LOAD_VALIDATING, &exception);

 

return ((Gdome_xml_DOMImplementation *)self)->vtab->createDocFromMemory

(self, buffer, mode, exc); -> gdome.c

 

ret = (GdomeDocument *)gdome_xml_n_mkref ((xmlNode *)xmlParseMem

ory (buffer, size)); - > gdome_xml-domimp.c

 

and then libxml.so

 

I am freeing up the memory used by xml doc (response_document) using

gdome_doc_unref at the end of the each transaction

 

Is this a BUG in memory management of gdome?

 

I have compiled the code with newer versions of libxml and gdome still the memory leak exists

 

I am kind of struck at this stage

 

Any help is appreciated

 

Thanks

 

 

Himalay Gopu

Openwave Systems

Phone: 571 241 8006

 


_______________________________________________
gdome mailing list
gdome@...
http://mail.gnome.org/mailman/listinfo/gdome

Re: gdome_di_createDocFromMemory Memory Leak

by Gustavo Sverzut Barbieri-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 11/16/06, Himalay Gopu <Himalay.Gopu@...> wrote:
> We are developing a threaded module (15 transactions per second) with gdome
> and we need to get the xml from memory and parse the same
>
> But when we try to use gdome_di_createDocFromMemory there seems to be a
> memory leak almost 6144 bytes for every transaction
>
> The leak starts from here

Some points:
 - gdome is not thread safe. while using it in a threaded environment,
I've found some bugs, one of them is creating singletons. I fixed the
one that did hurt at that point, but it was not making it thread safe,
instead I reordered the instructions so it would leak, but not crash.
Anyway, this shouldn't be the case, since the singleton is just
created once, and you may get no more than just few leaks (between:
'create singleton instance' and  'global = singleton-instance')
 - gdome uses glib and libxml  and they do their own memory management
and do cache. You need to compile these with options like
--enable-gc-friendly and --disable-mem-pool, see Glib user guide and
look at 'running glib applications', something like 'G_SLICER'

then you need to recheck your tests. :-)

--
Gustavo Sverzut Barbieri
--------------------------------------
Jabber: barbieri@...
   MSN: barbieri@...
  ICQ#: 17249123
 Skype: gsbarbieri
Mobile: +55 (81) 9927 0010
 Phone:  +1 (347) 624 6296; 08122692@...
   GPG: 0xB640E1A2 @ wwwkeys.pgp.net
_______________________________________________
gdome mailing list
gdome@...
http://mail.gnome.org/mailman/listinfo/gdome