You've already forked linux-packaging-mono
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
clang-tools-extra
compiler-rt
cmake
docs
include
lib
BlocksRuntime
asan
builtins
cfi
dfsan
esan
fuzzer
hwasan
interception
lsan
msan
profile
safestack
sanitizer_common
scudo
CMakeLists.txt
scudo_allocator.cpp
scudo_allocator.h
scudo_allocator_combined.h
scudo_allocator_secondary.h
scudo_crc32.cpp
scudo_crc32.h
scudo_flags.cpp
scudo_flags.h
scudo_flags.inc
scudo_interceptors.cpp
scudo_interface_internal.h
scudo_new_delete.cpp
scudo_platform.h
scudo_termination.cpp
scudo_tsd.h
scudo_tsd_exclusive.cpp
scudo_tsd_exclusive.inc
scudo_tsd_shared.cpp
scudo_tsd_shared.inc
scudo_utils.cpp
scudo_utils.h
stats
tsan
ubsan
ubsan_minimal
xray
CMakeLists.txt
test
unittests
www
.arcconfig
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
README.txt
eng
libcxx
libcxxabi
libunwind
lld
lldb
llvm
nuget
openmp
polly
Directory.Build.props
Directory.Build.targets
NuGet.config
azure-pipelines.yml
build.cmd
build.sh
dir.common.props
global.json
llvm.proj
mxe-Win64.cmake.in
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
75 lines
2.1 KiB
C++
75 lines
2.1 KiB
C++
![]() |
//===-- scudo_new_delete.cpp ------------------------------------*- C++ -*-===//
|
||
|
//
|
||
|
// The LLVM Compiler Infrastructure
|
||
|
//
|
||
|
// This file is distributed under the University of Illinois Open Source
|
||
|
// License. See LICENSE.TXT for details.
|
||
|
//
|
||
|
//===----------------------------------------------------------------------===//
|
||
|
///
|
||
|
/// Interceptors for operators new and delete.
|
||
|
///
|
||
|
//===----------------------------------------------------------------------===//
|
||
|
|
||
|
#include "scudo_allocator.h"
|
||
|
|
||
|
#include "interception/interception.h"
|
||
|
|
||
|
#include <stddef.h>
|
||
|
|
||
|
using namespace __scudo;
|
||
|
|
||
|
#define CXX_OPERATOR_ATTRIBUTE INTERCEPTOR_ATTRIBUTE
|
||
|
|
||
|
// Fake std::nothrow_t to avoid including <new>.
|
||
|
namespace std {
|
||
|
struct nothrow_t {};
|
||
|
} // namespace std
|
||
|
|
||
|
// TODO(alekseys): throw std::bad_alloc instead of dying on OOM.
|
||
|
CXX_OPERATOR_ATTRIBUTE
|
||
|
void *operator new(size_t size) {
|
||
|
void *res = scudoMalloc(size, FromNew);
|
||
|
if (UNLIKELY(!res)) DieOnFailure::OnOOM();
|
||
|
return res;
|
||
|
}
|
||
|
CXX_OPERATOR_ATTRIBUTE
|
||
|
void *operator new[](size_t size) {
|
||
|
void *res = scudoMalloc(size, FromNewArray);
|
||
|
if (UNLIKELY(!res)) DieOnFailure::OnOOM();
|
||
|
return res;
|
||
|
}
|
||
|
CXX_OPERATOR_ATTRIBUTE
|
||
|
void *operator new(size_t size, std::nothrow_t const&) {
|
||
|
return scudoMalloc(size, FromNew);
|
||
|
}
|
||
|
CXX_OPERATOR_ATTRIBUTE
|
||
|
void *operator new[](size_t size, std::nothrow_t const&) {
|
||
|
return scudoMalloc(size, FromNewArray);
|
||
|
}
|
||
|
|
||
|
CXX_OPERATOR_ATTRIBUTE
|
||
|
void operator delete(void *ptr) NOEXCEPT {
|
||
|
return scudoFree(ptr, FromNew);
|
||
|
}
|
||
|
CXX_OPERATOR_ATTRIBUTE
|
||
|
void operator delete[](void *ptr) NOEXCEPT {
|
||
|
return scudoFree(ptr, FromNewArray);
|
||
|
}
|
||
|
CXX_OPERATOR_ATTRIBUTE
|
||
|
void operator delete(void *ptr, std::nothrow_t const&) NOEXCEPT {
|
||
|
return scudoFree(ptr, FromNew);
|
||
|
}
|
||
|
CXX_OPERATOR_ATTRIBUTE
|
||
|
void operator delete[](void *ptr, std::nothrow_t const&) NOEXCEPT {
|
||
|
return scudoFree(ptr, FromNewArray);
|
||
|
}
|
||
|
CXX_OPERATOR_ATTRIBUTE
|
||
|
void operator delete(void *ptr, size_t size) NOEXCEPT {
|
||
|
scudoSizedFree(ptr, size, FromNew);
|
||
|
}
|
||
|
CXX_OPERATOR_ATTRIBUTE
|
||
|
void operator delete[](void *ptr, size_t size) NOEXCEPT {
|
||
|
scudoSizedFree(ptr, size, FromNewArray);
|
||
|
}
|