-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[proxy](4/n) use customized placement-new
- Loading branch information
1 parent
f11ad47
commit dbe7e47
Showing
6 changed files
with
47 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,6 @@ | |
#include "../ds/ds.h" | ||
#include "pooled.h" | ||
|
||
#include <new> | ||
|
||
namespace snmalloc | ||
{ | ||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#pragma once | ||
|
||
#include "snmalloc/ds_core/defines.h" | ||
|
||
namespace snmalloc | ||
{ | ||
|
||
// This is used in both vendored and non-vendored mode. | ||
struct PlacementToken | ||
{}; | ||
|
||
inline constexpr PlacementToken placement_token{}; | ||
} // namespace snmalloc | ||
|
||
SNMALLOC_FAST_PATH_INLINE void* | ||
operator new(size_t, void* ptr, snmalloc::PlacementToken) noexcept | ||
{ | ||
return ptr; | ||
} | ||
|
||
SNMALLOC_FAST_PATH_INLINE void* | ||
operator new[](size_t, void* ptr, snmalloc::PlacementToken) noexcept | ||
{ | ||
return ptr; | ||
} | ||
|
||
// The following is not really needed, but windows expects that new/delete | ||
// definitions are paired. | ||
SNMALLOC_FAST_PATH_INLINE void | ||
operator delete(void*, void*, snmalloc::PlacementToken) noexcept | ||
{} | ||
|
||
SNMALLOC_FAST_PATH_INLINE void | ||
operator delete[](void*, void*, snmalloc::PlacementToken) noexcept | ||
{} |