Hello,

I create an UsafeMutableRawPointer using the allocate method.

Later on I want to create a Data struct from this pointer using the bytesNoCopy 
initializer. Which deallocator should I pass?

It looks like this:

let retPointer = UnsafeMutableRawPointer.allocate(bytes: size, alignedTo: 
MemoryLayout<UInt8>.alignment)
….

let d = Data(bytesNoCopy: retPointer, count: size,deallocator:Deallocator.free)

Thanks,

Stéphane

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to