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

Add better profiling of heap for --profile-heap #1676

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AbrarQuazi
Copy link
Contributor

@AbrarQuazi AbrarQuazi commented Feb 19, 2025

--profile-heap currently lacks proper metrics to debug OOM issues and varies from the information provided from valgrind. This PR adds more relevant information about the garbage collector for each GC cycle, while also adding extra information in profiling csv file.

Example generated CSV file:
heap_log.csv

@@ -55,6 +57,42 @@ struct HeapStep {
HeapObject **found;
};

struct HeapAgeTracker {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Instead of having this entire class, and using an unordered_map to store heap age, I could have simply had a field inside HeapObject that keeps track of age for all HeapObjects:

struct HeapObject {

However, when I did this I had issues with alignment, as we have a strict requirement of having 8 bytes alignment for all GCObjects:

static_assert(sizeof(PadObject) == alignof(T), "HeapObject alignment wrong");

and I felt hesitant to change this requirement.

@AbrarQuazi AbrarQuazi requested a review from ag-eitilt February 19, 2025 20:09
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.

1 participant