Skip to content

Docs: clarify MemoryManager usage#2185

Closed
qorexdevs wants to merge 1 commit intogoogle:mainfrom
qorexdevs:docs-memory-manager-example
Closed

Docs: clarify MemoryManager usage#2185
qorexdevs wants to merge 1 commit intogoogle:mainfrom
qorexdevs:docs-memory-manager-example

Conversation

@qorexdevs
Copy link
Copy Markdown
Contributor

Adds a small MemoryManager registration example to the user guide.\n\nRefs #1217

Comment thread docs/user_guide.md Outdated
benchmark::RegisterMemoryManager(&mm);
benchmark::Initialize(&argc, argv);
benchmark::RunSpecifiedBenchmarks();
benchmark::RegisterMemoryManager(nullptr);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this necessary?

Comment thread docs/user_guide.md Outdated
public:
void Start() override {}

void Stop(Result& result) override {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a helpful example? it's a bit of a toy, but i think the complexity of using the memory manager is not in this interface, but in how to use it alongside something like tcmalloc.

maybe this should be an expanded tutorial on how to use it in its own documentation instead of this (what i consider fairly obvious) interface documentation.

@qorexdevs qorexdevs force-pushed the docs-memory-manager-example branch from 5b59cd7 to 4536d7a Compare May 5, 2026 08:39
@qorexdevs
Copy link
Copy Markdown
Contributor Author

Makes sense. I removed the toy example and replaced it with a shorter note that MemoryManager only bridges allocator or profiler data into JSON, with a pointer to custom counters for console/CSV or allocator-specific columns.

@qorexdevs qorexdevs changed the title Docs: add MemoryManager example Docs: clarify MemoryManager usage May 5, 2026
Comment thread docs/user_guide.md
activity. Reset that collector in `Start()`, then copy its final counters into
`MemoryManager::Result` in `Stop()`.

Use [Custom Counters](#custom-counters) instead when memory stats need to be
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no don't do this. we have the memory manager for exactly this reason. this would encourage users to run memory profiling in their performance sensitive micro benchmarks.

i don't think this PR is very useful.

@qorexdevs
Copy link
Copy Markdown
Contributor Author

Fair point. I'll close this then. Thanks for taking a look.

@qorexdevs qorexdevs closed this May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants