[Mono-dev] Malloc issue?
jonpryor at vt.edu
Fri Aug 24 13:47:54 UTC 2012
On Aug 23, 2012, at 2:35 AM, Greg Young <gregoryyoung1 at gmail.com> wrote:
> We are allocating and releasing unmanaged memory with marshal.allochglobal. In mono we are getting the following failure (no failures under clr).
> Any ideas?
That's not a mono error, that's a glibc assert (and thus cannot become an exception, ever):
> part from team city logs:
> [20:55:52][Step 2/2] mono: malloc.c:2451: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask) == 0)' failed.
Very probably coming from:
If not the first time through, we require old_size to be
at least MINSIZE and to have prev_inuse set.
assert((old_top == initial_top(av) && old_size == 0) ||
((unsigned long) (old_size) >= MINSIZE &&
((unsigned long)old_end & pagemask) == 0));
The line number is different, but it's the same file and the assert looks close enough (considering macro expansion, etc.).
In short, malloc(3) doesn't like you or something that you're doing. I would suggest setting the MALLOC_CHECK_ environment variable (see the malloc(3) man page), and/or "porting" your malloc use to C to verify that it also crashes there.
More information about the Mono-devel-list