You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Stephen Collyer <sc...@netspinner.co.uk> on 2008/05/22 21:00:45 UTC

Core dump with XMLReaderFactory::createXMLReader()

1. I'm getting a core dump in the constructor of a class
XMLParser which is initializing a ptr to a SAX2XMLReader
member variable declared like this:

>     private:                                                                    
>         std::auto_ptr<SAX2XMLReader> parser_;  

The constructor does this:

> XMLParser::XMLParser()
>             : parser_(XMLReaderFactory::createXMLReader())
> {

2. I have compiled and run test code which uses the
XMLParser class without problem. However, a new executable
is consistently dumping core with the following message:

> mdp_agent_exe: XMemory.cpp:62: static void* xercesc_2_7::XMemory::operator
> new(size_t, xercesc_2_7::MemoryManager*): Assertion `manager != 0' failed

3. The backtrace from gdb is:

> #0  0xffffe410 in __kernel_vsyscall ()
> #1  0xb69498f5 in raise () from /lib/libc.so.6
> #2  0xb694b1e1 in abort () from /lib/libc.so.6
> #3  0xb6942c1e in __assert_fail () from /lib/libc.so.6
> #4  0xb6f10279 in xercesc_2_7::XMemory::operator new () from /usr/lib/libxerces-c.so.27
> #5  0xb711cbb0 in xercesc_2_7::XMLReaderFactory::createXMLReader (manager=0x0, gramPool=0x0) at /usr/include/xercesc/sax2/XMLReaderFactory.hpp:66
> #6  0xb7119864 in XMLParser (this=0xbfb032a4) at /code/mdp_qt/src/lib/XMLParser.cpp:32

which seems to point the finger firmly at createXMLReader(),
though I have no idea what's going on in detail.

Does anyone have any idea what's causing this ? I can
see no significant difference between the exe that works
and the one that dumps core.

-- 
Regards

Steve Collyer
Netspinner Ltd

Re: Core dump with XMLReaderFactory::createXMLReader() - SOLVED

Posted by Jason Stewart <ja...@gmail.com>.
Hey Stephen,

2008/5/23 Stephen Collyer <sc...@netspinner.co.uk>:

> OK, panic over folks. I was failing to initialize
> Xerces in the offending executable. It all works
> now.

Hah! that would do it - no initialization - no default memory manager...

Cheers, jas.

Re: Core dump with XMLReaderFactory::createXMLReader() - SOLVED

Posted by Stephen Collyer <sc...@netspinner.co.uk>.
Stephen Collyer wrote:
> 1. I'm getting a core dump in the constructor of a class
> XMLParser which is initializing a ptr to a SAX2XMLReader
> member variable declared like this:

OK, panic over folks. I was failing to initialize
Xerces in the offending executable. It all works
now.

-- 
Regards

Steve Collyer
Netspinner Ltd

Re: Core dump with XMLReaderFactory::createXMLReader()

Posted by Jason Stewart <ja...@gmail.com>.
Hey Stephen!

Funny seeing you post on the c-user list these days!!

Defector! :-)

2008/5/23 Stephen Collyer <sc...@netspinner.co.uk>:

> 2. I have compiled and run test code which uses the
> XMLParser class without problem. However, a new executable
> is consistently dumping core with the following message:
>
>> mdp_agent_exe: XMemory.cpp:62: static void* xercesc_2_7::XMemory::operator
>> new(size_t, xercesc_2_7::MemoryManager*): Assertion `manager != 0' failed

[snip]

>> #5  0xb711cbb0 in xercesc_2_7::XMLReaderFactory::createXMLReader (manager=0x0, gramPool=0x0) at /usr/include/xercesc/sax2/XMLReaderFactory.hpp:66

Well, createXMLReader() is getting called without a memory manager -
so it is before this that the problem lies. It looks like something is
wrong in your XMLParser() code - you may have to show us that.

But I'm not a *real* Xerces-C programmer - so maybe someone else can
see the problem right away?

Cheers, jas.