v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
free_deleter.h
Go to the documentation of this file.
1
// Copyright 2016 The Chromium Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
// Slightly adapted for inclusion in V8.
6
// Copyright 2016 the V8 project authors. All rights reserved.
7
8
#ifndef V8_BASE_FREE_DELETER_H_
9
#define V8_BASE_FREE_DELETER_H_
10
11
#include <stdlib.h>
12
13
#include <memory>
14
15
#include "
src/base/platform/memory.h
"
16
17
namespace
v8
{
18
namespace
base
{
19
20
// Function object which invokes 'free' on its parameter, which must be
21
// a pointer. Can be used to store malloc-allocated pointers in std::unique_ptr:
22
//
23
// std::unique_ptr<int, base::FreeDeleter> foo_ptr(
24
// static_cast<int*>(malloc(sizeof(int))));
25
struct
FreeDeleter
{
26
inline
void
operator()
(
void
* ptr)
const
{
base::Free
(ptr); }
27
};
28
29
}
// namespace base
30
}
// namespace v8
31
32
#endif
// V8_BASE_FREE_DELETER_H_
memory.h
base
OpIndex base
Definition
instruction-selector-ia32.cc:65
v8::base::Free
void Free(void *memory)
Definition
memory.h:63
v8
Definition
api-arguments-inl.h:19
v8::base::FreeDeleter
Definition
free_deleter.h:25
v8::base::FreeDeleter::operator()
void operator()(void *ptr) const
Definition
free_deleter.h:26
src
base
free_deleter.h
Generated on Sun Apr 6 2025 21:08:50 for v8 by
1.12.0