denoland / deno_core

The core engine at the heart of Deno
MIT License
233 stars 76 forks source link

fix: `ModuleMap` was not dropped if it had pending futures #775

Closed dsherret closed 1 month ago

dsherret commented 1 month ago

During JsRuntime drop there were situations when ModuleMap was actually not dropped. This could happen if there were pending futures stored in the ModuleMap.

These futures contain references to ModuleMap. The situation lead to memory being leaked and subtle bugs in logic because the futures were not dropped either.

ModuleMap::destroy() was added that clear all pending futures and other relevant data from the map during destruction of JsRealm.

codecov-commenter commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 81.49%. Comparing base (0c7f83e) to head (5809066). Report is 28 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #775 +/- ## ========================================== + Coverage 81.43% 81.49% +0.05% ========================================== Files 97 97 Lines 23877 24006 +129 ========================================== + Hits 19445 19564 +119 - Misses 4432 4442 +10 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.