What do the different cases of the enumeration Data.Deallocator mean?

I'm having trouble finding explanations for the different cases of Data.Deallocator enumeration. It's used with the [init(bytesNoCopy:count:deallocator:) initializer to Data class] (https://developer.apple.com/documentation/foundation/data/1780455-init) Here's the different cases: Data.Deallocator.

The cases are:

custom free none unmap virtualMemory

Anyone know a website that explains those cases briefly and simply? Or do you know what they mean off the top of your head?

The method of deallocation based on the memory model.

Not sure that's exactly what you are looking for, but here is a code that uses them and give some explanations in comments.

https://github.com/Polidea/SiriusObfuscator/blob/master/SymbolExtractorAndRenamer/swift/stdlib/public/SDK/Foundation/Data.swift

Could you tell why you care ? What do you intent to do with ?

Maybe you could ask to Aupport as well.

Four out of five cases are documented here. I’m not sure what info you need beyond that.

With regards the fifth case, .virtualMemory, please file a bug requesting that it be documented. In the meantime you should simply ignore it [1].

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] The .virtualMemory case deallocates the memory by calling the kernel’s memory allocator directly, that is, vm_deallocate. You only need it if you allocated memory with the matching kernel memory allocator, or you got such memory from somewhere else, like an out-of-line Mach messaging buffer. Honestly, you should just stay away from that stuff.

What do the different cases of the enumeration Data.Deallocator mean?
 
 
Q