On Thu, Sep 18, 2014 at 9:20 PM, Flying Jester <[email protected]>
wrote:

> I don't believe you should be able to pass any old pointer into it. I'm
> saying it would vastly simplify things to be able to re-internalize a
> previously externalized pointer.
>

How this restriction solves anything?


>
> On Thursday, September 18, 2014 11:00:10 AM UTC-8, Dmitry Lomov wrote:
>
>>
>>
>> On Fri, Sep 12, 2014 at 11:38 PM, Flying Jester <[email protected]>
>> wrote:
>>
>>>
>>>
>>> Since V8 does not know how the memory backing an ArrayBuffer has been
>>>> allocated in this case, there is now good way for V8 to free it.
>>>>
>>>
>>> This doesn't make sense.
>>>
>>> A part of v8::ArrayBuffer::Allocator is a Free method. When you pass an
>>> allocator to v8::V8::SetArrayBufferAllocator, you are giving V8 all the
>>> tools to both allocate and deallocate memory for an ArrayBuffer.
>>>
>>
>> You can create an ArrayBuffer over external memory
>> (v8::ArrayBuffer::New(v8::Isolate*, void*, size_t)). V8 has no idea how
>> this data has been allocated.
>>
>>>
>>> I see absolutely no reason why you can't make the ArrayBuffer take
>>> ownership of the memory again when you are done with it. It took ownership
>>> when it was created. If it can't take ownership again, this sounds to me
>>> like a limitation of it's implementation, not an actual virtue of its
>>> design.
>>>
>>
>> I can imagine the API where embedder says to V8: "hey ArrayBuffer I
>> absolutely know what I am doing take ownership of this void*". The problem
>> with that is that people usually don't, they keep the reference to the
>> void* somewhere and later when an ArrayBuffer is garbage-collected it is
>> use-after-free and misery. I do not have a good solution for that yet.
>>
>> Dmitry
>>
>>
>>  --
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to