Re: mmap and munmap question/problem (under iOS, proably no important)
Re: mmap and munmap question/problem (under iOS, proably no important)
- Subject: Re: mmap and munmap question/problem (under iOS, proably no important)
- From: Derrick Brashear <email@hidden>
- Date: Sat, 04 Feb 2012 10:30:46 -0500
if that's really the problem, keep a bytemap (or larger; you need at
least one bit per thread) of standard sized pieces (page sized or
later) that you have mapped, and just refcount them. when the last ref
goes away, unmap.
On Sat, Feb 4, 2012 at 10:14 AM, David Hoerl <email@hidden> wrote:
> I have a huge file with which I use mmap to bring in selected pieces. When
> done, I then munmap the piece.
>
> However, my code is threaded, and I am getting crashes which I **believe**
> at this moment to be related to munmap. Specifically, if two threads map
> pieces in which overlap, the first munmap appears to unmap the area used by
> the second thread, and boom, down goes my app.
>
> If I'm correct in this assumption, then it occurred to me that if I could
> chunk my memory such that no two pieces would appear on the same page, the
> problem would go away. The only other alternative I've thought of is just
> queuing all munmap calls until such time that all threads finish.
>
> Sooo - is there better solution to the above. I've used mmap before, but am
> no expert by any means!
>
> Thanks for any suggestions or comments!
>
> David
> _______________________________________________
> 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
--
Derrick
_______________________________________________
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