Re: [xml] Segfault in xmlDocDumpMemory with efence

On Thu, Feb 19, 2004 at 03:23:31PM -0800, Dirk Morris wrote:
Daniel Veillard wrote:

Crash in malloc in Linux are usually due to a corrupted
memory allocator data structure. Use valgrind with your code it
offers a far more systematic check than efence,

I believe Electric fence's malloc doesnt use fenceposts like the libc's 
malloc, so I doubt this is the issue.
Each allocation gets its own page surrounded by two unmapped pages, so 
it is impossible to walk
to any other allocated memory without hitting an unmapped page first.

I can't use valgrind on this code because it doesnt support the needed 
system calls yet.

  you have libxml2 code, gdb and see what's happening in that 

xmlBufferCreate(void) {
    xmlBufferPtr ret;
    ret = (xmlBufferPtr) xmlMalloc(sizeof(xmlBuffer));
    if (ret == NULL) {
        xmlTreeErrMemory("creating buffer");
    ret->use = 0;
    ret->size = xmlDefaultBufferSize;
    ret->alloc = xmlBufferAllocScheme;
    ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar));
    if (ret->content == NULL) {
        xmlTreeErrMemory("creating buffer");
    ret->content[0] = 0;

 xmlDefaultBufferSize is 4096 by default. If the memory structures
are not corrupted, tell me what's happening !


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]