[haiku-development] Re: weird segfault in malloc internals when trying to call fdopen()
- From: Michael Crawford <mdcrawford@xxxxxxxxx>
- To: haiku-development@xxxxxxxxxxxxx
- Date: Sun, 18 Oct 2009 02:15:39 -0700
Does Haiku even provide the sbrk system call?
I vaguely recall that the BeOS didn't, but that programs that needed
more virtual memory would create something called an area. Areas are
documented somewhere in the BeBook; it shouldn't be hard to find.
An area is just a region of usable virtual memory, more similar
conceptually to an mmaped region than to the memory below the sbrk.
On real UNIX systems, malloc obtains more VM from the system by
increasing the value of the break, that is, the boundary between
mapped and unmapped memory space. The value of the break, from the
perspective of user code, is just a pointer to the uppper end of the
lower part of usable memory.
BeOS areas are mapped regions as well, but they are basically mapped
islands within a sea of unmapped memory. I think they were meant
mainly to support threads - a new thread would need some stack space,
so the OS would create an area and the thread would use that.
malloc can use areas, but unlike the UNIX break, it can't assume that
the areas are contiguous - they are distinctly not contiguous. Malloc
would have to split its allocations among the various areas; if it
needed to allocate more space than was available in just one single
area, it would have to make a new area that was big enough.
If Emacs is assuming that all of its malloced memory is in one
contiguous range of virtual memory, then it will totally bork when it
tries to dump memory that is distributed across more than one area.
Hope That Helps.
Mike
--
Michael David Crawford
mdcrawford at gmail dot com
GoingWare's Bag of Programming Tricks
http://www.goingware.com/tips/
- Follow-Ups:
- References:
- [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen()
- From: Alexander Botero-Lowry
- [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen()
- From: François Revol
- [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen()
- From: Michael Zucchi
- [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen()
- From: Alexander Botero-Lowry
- [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen()
Other related posts:
- » [haiku-development] weird segfault in malloc internals when trying to call fdopen() - Alexander Botero-Lowry
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - Alexander Botero-Lowry
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - Ingo Weinhold
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - Michael Crawford
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - Caitlin Shaw
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - Alexander Botero-Lowry
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - Alexander Botero-Lowry
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - Alexander Botero-Lowry
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - Urias McCullough
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - Michael Crawford
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - Alexander Botero-Lowry
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - François Revol
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - Michael Zucchi
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - Alexander Botero-Lowry
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - Michael Crawford
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - François Revol
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - François Revol
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - Michael Lotz
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - Michael Zucchi
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - Michael Crawford
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - Alexander Botero-Lowry
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - François Revol
- » [haiku-development] Re: weird segfault in malloc internals when trying to call fdopen() - François Revol