Skip to content

Survived Memory - #1596

Closed
timcassell wants to merge 3 commits into
dotnet:masterfrom
timcassell:survivedMemory
Closed

Survived Memory#1596
timcassell wants to merge 3 commits into
dotnet:masterfrom
timcassell:survivedMemory

Conversation

@timcassell

@timcassell timcassell commented Nov 18, 2020

Copy link
Copy Markdown
Collaborator

In an attempt to address my question on #1579, I worked on this.

I added an optional includeSurvived flag on MemoryDiagnoserAttribute and --memorySurvived command line option to capture the survived memory from a benchmark run.

@dnfadmin

dnfadmin commented Nov 18, 2020

Copy link
Copy Markdown

CLA assistant check
All CLA requirements met.

@timcassell

timcassell commented Dec 1, 2020

Copy link
Copy Markdown
Collaborator Author

.NET Core 3.1 and 5.0 measurement issue: dotnet/runtime#45446

@timcassell

timcassell commented Jul 9, 2022

Copy link
Copy Markdown
Collaborator Author

Looks like measurement errors are fixed in .Net 7 as of dotnet/runtime#67160.

@timcassell
timcassell force-pushed the survivedMemory branch 2 times, most recently from 51d25f1 to 73fffb5 Compare March 18, 2024 06:54
@timcassell
timcassell marked this pull request as draft March 18, 2024 07:03
@timcassell
timcassell force-pushed the survivedMemory branch 3 times, most recently from 7b8667d to 91027de Compare March 18, 2024 09:14
@timcassell
timcassell marked this pull request as ready for review March 18, 2024 11:56
@JaggerJo

Copy link
Copy Markdown
Contributor

Looking forward to this feature 👀

@timcassell

timcassell commented Jun 25, 2025

Copy link
Copy Markdown
Collaborator Author

Unfortunately, survived memory is not so simple for the framework to measure automatically. The first invocation will include jit allocations and static memory, and the second invocation will miss pooled objects. When I used this in my own benchmarks (https://github.com/timcassell/CSharpAsynchronousBenchmarks), I took care to measure only pooled objects by adjusting the benchmarks in a complicated way. I don't think it's good for users to have to do that to get useful measurements. I think this will be better served by #784, so users can capture the survived memory that matters to them.

@timcassell timcassell closed this Jun 25, 2025
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.

3 participants