I added a debug print as you suggested to see how much memory it's trying to allocate. Here's the output:

newmod: 219
newmod: 439
Segmentation fault

Line 228 looks suspicious: newMod * sizeof(ValueHashTableBucketElem<TVal>*)

TVal is of type bool which is 1 byte, but it's allocating for the size of a pointer which is 4 bytes. That would mean it's allocating more space than needed though, not less.

Ben

On 10/04/2016 09:56 AM, Vitaly Prapirny wrote:
I know nothing about your platform. If I understand your stack trace correctly, the library failed to allocate block of 4294967168 bytes.

You can try to rebuild xerces with
typedef unsigned long XMLSize_t;

Or simply add debug output into the 'void ValueHashTableOf<TVal, THasher>::rehash()' near ./xercesc/util/ValueHashTableOf.c:225 and see why the library wants to allocate so huge block.

Good luck!
   Vitaly

Benjamin DuPont wrote:
Thanks Vitaly. Do you have any tips on how to fix this? Looks to be defined as a size_t which is probably correct:

#define XERCES_SIZE_T size_t

typedef XERCES_SIZE_T                XMLSize_t;

Ben


On 10/04/2016 02:10 AM, Vitaly Prapirny wrote:
Hi Benjamin,

Seems like XMLSize_t type has been defined incorrectly on your platform.

Good luck!
   Vitaly

Benjamin DuPont wrote:
I'm trying to build xerces for OpenWRT on the rpi zero. xerces segfaults in XMLPlatformUtils::Initialize(). I've tried 3.1.1, 3.1.2, and 3.1.4 all with the same result. I'm building with the following arguments:

    --disable-pretty-make \
    --enable-transcoder-iconv \
    --enable-netaccessor-socket \
    --enable-msgloader-inmemory

Here's the stack trace:

#0 0xb6fb1fc4 in unbin (c=c@entry=0xb6bad348, i=i@entry=42) at src/malloc/malloc.c:219
#1  0xb6fb2b30 in malloc (n=4294967168) at src/malloc/malloc.c:346
#2  0xb6c3aa30 in operator new(unsigned int) ()
from /home/dupes/data/projects/epri/cea2045/openwrt/source/rpi/openwrt/scripts/../staging_dir/target-arm_arm1176jzf-s+vfp_musl-1.1.15_eabi/root-brcm2708/usr/lib/libstdc++.so.6 #3 0xb6e34268 in xercesc_3_1::MemoryManagerImpl::allocate (this=<optimized out>,
    size=<optimized out>) at xercesc/internal/MemoryManagerImpl.cpp:40
#4 0xb6db9e1c in xercesc_3_1::ValueHashTableOf<bool, xercesc_3_1::StringHasher>::rehash ( this=this@entry=0xb6f88438) at ./xercesc/util/ValueHashTableOf.c:225 #5 0xb6db9a3c in xercesc_3_1::ValueHashTableOf<bool, xercesc_3_1::StringHasher>::put ( valueToAdopt=<optimized out>, key=0xb6ed0ae6 <xercesc_3_1::gEncodingArray+15088>,
    this=0xb6f88438) at ./xercesc/util/ValueHashTableOf.c:186
#6 xercesc_3_1::EncodingValidator::initializeRegistry (this=this@entry=0xb6f88420)
    at xercesc/util/EncodingValidator.cpp:79
#7 0xb6db9b38 in xercesc_3_1::EncodingValidator::EncodingValidator (this=0xb6f88420)
    at xercesc/util/EncodingValidator.cpp:50
#8 0xb6db9b5c in xercesc_3_1::XMLInitializer::initializeEncodingValidator ()
    at xercesc/util/EncodingValidator.cpp:34
#9  0xb6dd80fc in xercesc_3_1::XMLInitializer::initializeStaticData ()
    at xercesc/util/XMLInitializer.cpp:44
#10 0x000105c4 in main ()






--
Ben DuPont
Owner/Operator
nebland software, LLC
b...@nebland.com | (920)328-5236
www.nebland.com

Reply via email to