Skip to content

Commit

Permalink
Fix medium-sized TypedArray crashes
Browse files Browse the repository at this point in the history
I got this wrong in 8af559f.

Fixes #61
  • Loading branch information
laverdet committed Apr 5, 2018
1 parent e027c8c commit a13ef6e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/isolate/allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void* LimitedAllocator::Allocate(size_t length) {
return std::calloc(length, 1);
} else {
++failures;
if (length <= 16) { // kMinAddedElementsCapacity
if (length <= 64) { // kMinAddedElementsCapacity * sizeof(uint32_t)
// When a tiny TypedArray is created v8 will avoid calling the allocator and instead just use
// the internal heap. This is all fine until someone wants a pointer to the underlying buffer,
// in that case v8 will "materialize" an ArrayBuffer which does invoke this allocator. If the
Expand All @@ -62,7 +62,7 @@ void* LimitedAllocator::AllocateUninitialized(size_t length) {
return std::malloc(length);
} else {
++failures;
if (length <= 16) {
if (length <= 64) {
env.extra_allocated_memory += length;
env.Terminate();
return std::malloc(length);
Expand Down

0 comments on commit a13ef6e

Please sign in to comment.