node-chakracore
node-chakracore copied to clipboard
Buffer.unsafeAlloc() still zero-fills
- Version: v8.0.0-pre
- Platform: Windows
- Subsystem: buffer
A recently fixed test (in node-v8) has started failing in node-chakracore. The test ensures that the buffers returned from Buffer.unsafeAlloc() are not zero-filled (which is the ES6 standard).
=== release test-buffer-bindingobj-no-zerofill ===
Path: parallel/test-buffer-bindingobj-no-zerofill
Command: E:\GitHub\node-chakracore\Release\node.exe --expose-internals E:\GitHub\node-chakracore\test\parallel\test-buffer-bindingobj-no-zerofill.js
--- TIMEOUT ---
The test simply executes in a loop allocating new buffers and looking for any uint8 value which is non-zero. Digging into the code it appears that node introduces a custom allocator by overriding a method in v8:
void* ArrayBufferAllocator::Allocate(size_t size) {
if (zero_fill_field_ || zero_fill_all_buffers)
return node::UncheckedCalloc(size);
else
return node::UncheckedMalloc(size);
}
I've debugged the test case and can confirm that the method is never called.
EDIT: As @addaleax mentioned, I'll skip the test for now.
Fwiw, the non-filling is an optimization – I think you can just skip the test in chakracore, if you want.