mmap quiet failure - all reads are 0x00

2016-02-05 Thread Trygve Inda
I have image data that is stored in a 150mb file which I use mmap to read.

The image data is pulled into a NSBitmapImageRep pixel by pixel and
eventually shows on the screen. Only a subset of the pixel in the mmap file
are pulled into a single NSBitmapImageRep.

A few customers (and I have seen it happen here a couple times too) are
reporting that sometimes the image just turns solid black.

It seems like no matter what is in the mmap file, when I read from it I get
0x00 for every byte and no error or exception is generated. I can't
reproduce it as it is very random. Quitting and relaunching solves it.

Any ideas?

Trygve



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: mmap quiet failure - all reads are 0x00

2016-02-05 Thread Michael David Crawford
Perhaps it is a bug unrelated to mmap, that screws up some of your
state, then later it causes the mmap to fail.

Or perhaps the mmap succeeds, but the bytes your are reading are
coming from some other place.

There are many debugging techniques, such as using assertions, guard
malloc etc.  But don't just focus narrowly on the mmap itself.
Michael David Crawford, Baritone
mdcrawf...@gmail.com

  One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To Light.


On Fri, Feb 5, 2016 at 4:36 PM, Jens Alfke  wrote:
>
>> On Feb 5, 2016, at 10:09 AM, Trygve Inda  wrote:
>>
>> It seems like no matter what is in the mmap file, when I read from it I get
>> 0x00 for every byte and no error or exception is generated. I can't
>> reproduce it as it is very random. Quitting and relaunching solves it.
>
> That sounds strange to me. I’m not an expert at mmap, but my understanding is 
> that if a page fault can’t be satisfied the memory access will fail with a 
> signal. You might ask on the darwin-userlevel list since this is really a 
> Unix-level question.
>
> —Jens
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/mdcrawford%40gmail.com
>
> This email sent to mdcrawf...@gmail.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: mmap quiet failure - all reads are 0x00

2016-02-05 Thread Jens Alfke

> On Feb 5, 2016, at 10:09 AM, Trygve Inda  wrote:
> 
> It seems like no matter what is in the mmap file, when I read from it I get
> 0x00 for every byte and no error or exception is generated. I can't
> reproduce it as it is very random. Quitting and relaunching solves it.

That sounds strange to me. I’m not an expert at mmap, but my understanding is 
that if a page fault can’t be satisfied the memory access will fail with a 
signal. You might ask on the darwin-userlevel list since this is really a 
Unix-level question.

—Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com