Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: separate out NgLibMemoryManagerBase #33104

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/node_mem.h
Expand Up @@ -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;
Expand All @@ -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);
Expand Down