<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hello,<div class=""><br class=""></div><div class="">I create an UsafeMutableRawPointer using the allocate method.</div><div class=""><br class=""></div><div class="">Later on I want to create a Data struct from this pointer using the bytesNoCopy initializer. Which deallocator should I pass?</div><div class=""><br class=""></div><div class="">It looks like this:</div><div class=""><br class=""></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #0433ff" class="">let</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> retPointer = </span><span style="font-variant-ligatures: no-common-ligatures" class="">UnsafeMutableRawPointer</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">.</span><span style="font-variant-ligatures: no-common-ligatures" class="">allocate</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(bytes: size, alignedTo: </span><span style="font-variant-ligatures: no-common-ligatures" class="">MemoryLayout</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&lt;</span><span style="font-variant-ligatures: no-common-ligatures" class="">UInt8</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&gt;.</span><span style="font-variant-ligatures: no-common-ligatures" class="">alignment</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">)</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">….</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><br class=""></span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175);" class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #0433ff" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> d = </span><span style="font-variant-ligatures: no-common-ligatures;" class="">Data</span><span style="font-variant-ligatures: no-common-ligatures" class="">(bytesNoCopy: retPointer, count: size,deallocator:</span><span style="font-variant-ligatures: no-common-ligatures;" class="">Deallocator</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures;" class="">free</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; line-height: normal;" class=""><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px;" class="">Thanks,</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px;" class="">Stéphane</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px;" class=""><br class=""></div></div></div></body></html>