Ben Aston
Ben Aston

Reputation: 55789

Are ES2015 typed arrays allocated inside the runtime heap?

Are ES2015 typed arrays allocated inside the runtime heap?

Or is it left to implementation?

If I understand correctly, Node.js Buffer instances are allocated outside the runtime heap (source: "A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap").

Upvotes: 2

Views: 203

Answers (1)

Bergi
Bergi

Reputation: 665574

ECMAScript 6 does not specify any mechanism of memory allocation.

Engines are free to implement what they want. I'd expect them to be allocated on the heap as it is the default for all objects, but they might as well go on the stack frame for optimisation purposes or in a dedicated "heap" segment with special garbage collection semantics.

Upvotes: 3

Related Questions