Re: Problem using .zerofill / -segaddr to create very large segments
Re: Problem using .zerofill / -segaddr to create very large segments
- Subject: Re: Problem using .zerofill / -segaddr to create very large segments
- From: Alastair Houghton <email@hidden>
- Date: Tue, 22 Sep 2009 10:09:00 +0100
On 21 Sep 2009, at 22:57, Brian Mastenbrook wrote:
The problem is that code, the malloc heap, etc. are already placed
in memory at that point. Using a zero-fill segment in an object
reserves the heap space first, which forces the linker to move any
relocatable code and the malloc heap to be allocated elsewhere. This
is useful in general for image-based programming languages that are
natively compiled, as you can save an image and then re-map it in
memory as it was originally represented.
That clarifies things considerably...
I assume, given the above, that the motivation for this is that you're
trying to set things up such that pointers in the shared memory all
have the same addresses in each of the processes, and that means you
want to reserve the same block of address space no matter what.
So I guess the next question is why not move the shared memory segment
further away from the heap's initial location? Or alternatively, why
not use offsets rather than pointers within the shared segment (of
course, there will be a performance hit, but offsets might result in
safer code anyway), in which case you don't need to use MAP_FIXED?
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden