Skip to content

Commit 1d69c6f

Browse files
committed
src: separate out NgLibMemoryManagerBase
Extracted from the [QUIC PR](nodejs#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 <[email protected]> PR-URL: nodejs#33104 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Sam Roberts <[email protected]>
1 parent 49db211 commit 1d69c6f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/node_mem.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ namespace mem {
1313
// use different struct names. To allow for code re-use,
1414
// the NgLibMemoryManager template class can be used for both.
1515

16+
struct NgLibMemoryManagerBase {
17+
virtual void StopTrackingMemory(void* ptr) = 0;
18+
};
19+
1620
template <typename Class, typename AllocatorStructName>
17-
class NgLibMemoryManager {
21+
class NgLibMemoryManager : public NgLibMemoryManagerBase {
1822
public:
1923
// Class needs to provide these methods:
2024
// void CheckAllocatedSize(size_t previous_size) const;
@@ -24,7 +28,7 @@ class NgLibMemoryManager {
2428

2529
AllocatorStructName MakeAllocator();
2630

27-
void StopTrackingMemory(void* ptr);
31+
void StopTrackingMemory(void* ptr) override;
2832

2933
private:
3034
static void* ReallocImpl(void* ptr, size_t size, void* user_data);

0 commit comments

Comments
 (0)