summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2020-04-27 13:09:56 -0700
committerMichaƫl Zasso <targos@protonmail.com>2020-05-04 14:23:25 +0200
commit541ea035bf1cd62ad107c58f817c2145ce82243d (patch)
tree13c7a88340c7e2901c46a0fa8239e272a2da1104
parent23962191c134cd389bab7beefe93735c60ccc3e3 (diff)
downloadnode-new-541ea035bf1cd62ad107c58f817c2145ce82243d.tar.gz
src: separate out NgLibMemoryManagerBase
Extracted from the [QUIC PR](https://github.com/nodejs/node/pull/32379) So far, this is only used by the QUIC PR directly but the change itself is independent of QUIC, even if not used directly by anything else yet. Separated out per request. Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/33104 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
-rw-r--r--src/node_mem.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/node_mem.h b/src/node_mem.h
index 0d3388ad47..f8cdc20848 100644
--- a/src/node_mem.h
+++ b/src/node_mem.h
@@ -13,8 +13,12 @@ namespace mem {
// use different struct names. To allow for code re-use,
// the NgLibMemoryManager template class can be used for both.
+struct NgLibMemoryManagerBase {
+ virtual void StopTrackingMemory(void* ptr) = 0;
+};
+
template <typename Class, typename AllocatorStructName>
-class NgLibMemoryManager {
+class NgLibMemoryManager : public NgLibMemoryManagerBase {
public:
// Class needs to provide these methods:
// void CheckAllocatedSize(size_t previous_size) const;
@@ -24,7 +28,7 @@ class NgLibMemoryManager {
AllocatorStructName MakeAllocator();
- void StopTrackingMemory(void* ptr);
+ void StopTrackingMemory(void* ptr) override;
private:
static void* ReallocImpl(void* ptr, size_t size, void* user_data);