[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] TypedArray constructors and zero length

----- "Cedric Vivier" <cedricv@neonux.com> wrote:

> On Thu, Jun 10, 2010 at 06:44, Cedric Vivier <cedricv@neonux.com>
> wrote:
> >> While -1 will convert
> >> to a large number, implementations are expected to attempt the
> >> allocation, fail, and return a buffer with zero length.
> >
> > Are you implying TypedArray construction can never fail then ?
> > IF returning a zero-length array is the behavior only when "a large
> > number" is passed, how implementations should differentiate "a
> large
> > number" which couldn't be allocated from "out of memory (within the
> > resource limits of the Javascript context or GC)" ?
> >
> FWIW I wrote some tests on this today, Mozilla has the sane behavior
> of throwing an exception ("invalid array size") when length is
> negative while WebKit swaps like crazy attempting to allocate
> memory... and in the end returns "undefined".

Note that we don't throw because it's negative, but because it's larger than the biggest size that we allow due to implementation constraints (roughly 2^31).

    - Vlad
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: