Skip to content

Conversation

@bpcreech
Copy link
Owner

@bpcreech bpcreech commented May 12, 2024

We were sometimes leaking isolates on shutdown because of reference cycles. In particular, the IsolateManager could be running a perpetual (or self-restarting) task which contains shared_ptr references to objects which in turn contain shared_ptr references to the IsolateManager.

This change simplifies the lifecycle of most things in the C++ side of PyMiniRacer. Instead of using shared_ptr to manage lifecycle, we more explicitly manage lifecycles. Any objects which send tasks to the IsolateManager are, obviously, responsible for ensuring those tasks complete before any objects those tasks reference (usually including the task-creating this object) are destructed. IsolateManager::Run now returns a future to make that easier to do.

Closes #62.

@bpcreech bpcreech force-pushed the feature/fix-teardown branch from d765e3e to 80e7752 Compare May 13, 2024 03:09
@bpcreech bpcreech force-pushed the feature/fix-teardown branch 6 times, most recently from 82b611a to c298d4d Compare May 19, 2024 15:54
@bpcreech bpcreech force-pushed the feature/fix-teardown branch from c298d4d to 092aeed Compare May 19, 2024 16:24
@bpcreech bpcreech merged commit 7a18164 into main May 19, 2024
@bpcreech bpcreech deleted the feature/fix-teardown branch May 27, 2024 21:26
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.

Potential use-after-free and uncollected garbage

2 participants