• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Memory-mapped sub-data?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory-mapped sub-data?


  • Subject: Re: Memory-mapped sub-data?
  • From: Chris Ridd <email@hidden>
  • Date: Mon, 27 Feb 2017 18:02:01 +0000

> On 27 Feb 2017, at 16:56, Jens Alfke <email@hidden> wrote:
>
>
>> On Feb 26, 2017, at 2:34 PM, Daryle Walker <email@hidden> wrote:
>>
>> If I take a "subdata" of a memory-mapped (NS)Data, does it stay mapped (i.e. use a range and reference)? Or does a full copy get made? I'm thinking of making a parser be a sub-parser too, and this would make the difference between scanning the next megabyte or the rest-of-file (even if it's gigabytes).
>
> Whew … that’s definitely an implementation detail, and the sort of thing that I’d imagine can change from one OS version to another. There are cases like yours where this behavior can be hugely valuable, and others where it can be a big performance problem (not so much with mapped data,  but definitely with heap allocations.) Even if you did some experiments today and found that it works the way you want, there’s no guarantee it’ll keep working that way.

It isn’t NSData, but libdispatch’s dispatch_data_t might be a useful way forward. The dispatch_data_create(3) man page says it avoids "copying the represented memory as much as possible.”

Chris
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Memory-mapped sub-data?
      • From: Jens Alfke <email@hidden>
References: 
 >Memory-mapped sub-data? (From: Daryle Walker <email@hidden>)
 >Re: Memory-mapped sub-data? (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Memory-mapped sub-data?
  • Next by Date: Re: Need replacement of Component Manager::OpenDefaultComponent
  • Previous by thread: Re: Memory-mapped sub-data?
  • Next by thread: Re: Memory-mapped sub-data?
  • Index(es):
    • Date
    • Thread