On Thursday, September 18, 2014 2:10:13 PM UTC-7, Dmitry Lomov wrote:
>
>
> On Thu, Sep 18, 2014 at 10:54 PM, Flying Jester <[email protected] 
> <javascript:>> wrote:
>>
>>
>> If you keep a reference to memory after you explicitly give up ownership 
>> of its lifetime and it later gets freed, that is not the library's fault.
>>
>
> I wish it weren't :) API design is not a blame game, and this is the point 
> of our disagreement, of course.
>

Originally the ArrayBuffer API did allow the user to pass in and access 
memory without having to externalize it. That was a huge advantage because 
of all the performance optimizations that have been done for ArrayBuffers. 
Unfortunately those are lost once the memory has to be externalized. I hope 
that part of the initial API is brought back.

Currently there is a way to circumvent part of the API limitation with a 
(horrible) hack. That is to create a global (well, as far as the 
v8::Isolate is concerned) void* and then to assign the data you wish to 
turn into an ArrayBuffer to it just before the call to 
v8::ArrayBuffer::Allocator::Allocate(). Then inside Allocate() check if the 
void* == NULL. If not then return that instead. This way I can at least 
initialize an ArrayBuffer with existing memory.

Though the limitation of not being able to access the data once it's been 
passed to an ArrayBuffer without needing to externalize it is still a 
serious bummer.

-- 
-- 
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