• 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
NSMutableData and Pinned Memory buffers..
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSMutableData and Pinned Memory buffers..


  • Subject: NSMutableData and Pinned Memory buffers..
  • From: Robert Monaghan <email@hidden>
  • Date: Thu, 13 Dec 2012 14:28:33 -0800

Hi Everyone,

I have just run head long into an issue with NSMutableData and existing buffers.
I have the following code:


			UInt8 *sourcebytes = [clImgEngine srcBuffer];
			[self setData:[NSMutableData dataWithBytesNoCopy:sourcebytes length:[clImgEngine inRangeByteCount] freeWhenDone:NO]];
			UInt8 *resultBytes = [[self data] mutableBytes];

The source is a pinned memory buffer from OpenCL. What I want to do, is to pass this buffer inside a NSMutableData wrapper and have another object for some work.
Seems simple enough, except that NSMutableData changes the memory buffer in the background.

"sourcebytes" starts with an address such as: 0x000000012361b000
and "resultBytes" returns 0x0000000136fe2000

Naturally, my work object doesn't see any data from "sourcebytes", as NSMutableData has moved the buffer.
I thought that freeWhenDone:NO prevented ownership of the buffer..

Can anyone suggest a way to prevent this from happening? I need the buffer to stay "pinned".

Thanks in advance!

bob.

_______________________________________________

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: NSMutableData and Pinned Memory buffers..
      • From: Kevin Perry <email@hidden>
  • Prev by Date: Re: Bindings validation for NSMutableArray of NSMutableDictionary
  • Next by Date: Re: What rect does NSTextFieldCell use to draw its contents?
  • Previous by thread: Re: Bindings validation for NSMutableArray of NSMutableDictionary
  • Next by thread: Re: NSMutableData and Pinned Memory buffers..
  • Index(es):
    • Date
    • Thread