-
Notifications
You must be signed in to change notification settings - Fork 229
Description
Admin comment by @mit-mit:
This request is being tracked as a feature via issue dart-lang/sdk#47772.
For details, see the working proposal feature specification:
https://github.com/dart-lang/language/blob/master/accepted/future-releases/1847%20-%20FinalizationRegistry/proposal.md
Original feature request by @jacob314:
The C API for Dart has always exposed this functionality but it was not exposed in the Dart core libraries because it could not be implemented in JavaScript.
The WeakRef proposal has now landed in JavaScript so WeakRef and finalization tracking could now supported in debug Dart builds on all platforms.
Support is available in all major browsers but Safari so the feature would need to be prohibited in release builds until that changes.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
https://github.com/tc39/proposal-weakrefs
Providing this APIs would allow Dart memory leak detection tools to work on both the Dart VM and JavaScript and would simplify integration of leak detection tools into unittests on the VM. For example, without this API, the VMService must be used to detect leaked objects with some performance overhead to find all instances of the LeakedObject class.
The apis could reasonably be exposed in dart:core, dart:collection (as an iterable WeakMap), or dart:developer.
It could make sense to expose this in dart:developer as that would make it less surprising if the APIs work in debug environments but not production environments.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status