<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Typed Arrays have no public facing API"
   href="https://bugs.webkit.org/show_bug.cgi?id=120112#c17">Comment # 17</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Typed Arrays have no public facing API"
   href="https://bugs.webkit.org/show_bug.cgi?id=120112">bug 120112</a>
              from <span class="vcard"><a class="email" href="mailto:fpizlo&#64;apple.com" title="Filip Pizlo &lt;fpizlo&#64;apple.com&gt;"> <span class="fn">Filip Pizlo</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=120112#c16">comment #16</a>)
<span class="quote">&gt; How do you create a typed array with a data pointer? Is the input a void*?</span >

Yes.

<span class="quote">&gt; Is the data copied or referenced through some delegate API?</span >

Referenced.  For example the &quot;keep&quot; argument could be interpreted as:

keep=true: we call the system free() on the original void* when we decide to free the buffer.

keep=false: we don't free the original void* buffer when we free the array buffer, and the only way that the client can be sure that we no longer want the backing data is when they destroy the VM.

Having a free callback would be even better.

The use cases for this are things like:

- Native code mmap's something and wants JS to be able to modify the mmap'd memory.
- Native code gets some buffer from some other native API and wants JS to be able to play with that buffer.
- Ad hoc wrapping of native buffers in C-&gt;JS calls (in that case keep=false works well enough).  Like, C code gets a piece of text and wants to zero-copy pass it to some JS handler, with the expectation that the handler won't squirrel away that buffer after it returns.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>