Skip to content

Conversation

rohitpruthi-google
Copy link
Contributor

This pull request fixes a race condition in the heap profiler that could cause
heap.profile() to return an empty profile if called immediately after heap.start().

The issue was that heap.profile() could be called before the V8 heap profiler had
collected any samples, resulting in a blank snapshot.

This change fixes the issue by introducing a polling mechanism in the C++ addon. The
GetAllocationProfile function now waits for the profiler to collect at least one sample
before returning a profile. This ensures that heap.profile() always returns a valid
profile.

Fixes #310

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.

a delay is required after heap.start and heap.profile()

1 participant