mirror of
https://github.com/denoland/deno.git
synced 2025-01-11 08:33:43 -05:00
41c7e96f1a
* In order to prevent ArrayBuffers from getting garbage collected by V8, we used to store a v8::Persistent<ArrayBuffer> in a map. This patch introduces a custom ArrayBuffer allocator which doesn't use Persistent handles, but instead stores a pointer to the actual ArrayBuffer data alongside with a reference count. Since creating Persistent handles has quite a bit of overhead, this change significantly increases performance. Various HTTP server benchmarks report about 5-10% more requests per second than before. * Previously the Persistent handle that prevented garbage collection had to be released manually, and this wasn't always done, which was causing memory leaks. This has been resolved by introducing a new `PinnedBuf` type in both Rust and C++ that automatically re-enables garbage collection when it goes out of scope. * Zero-copy buffers are now correctly wrapped in an Option if there is a possibility that they're not present. This clears up a correctness issue where we were creating zero-length slices from a null pointer, which is against the rules.
12 lines
355 B
C
12 lines
355 B
C
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
|
#ifndef TEST_H_
|
|
#define TEST_H_
|
|
|
|
#include "deno.h"
|
|
#include "testing/gtest/include/gtest/gtest.h"
|
|
|
|
extern deno_snapshot snapshot; // Loaded in libdeno/test.cc
|
|
const deno_buf empty = {nullptr, 0, nullptr, 0};
|
|
const deno_snapshot empty_snapshot = {nullptr, 0};
|
|
|
|
#endif // TEST_H_
|