[vm, api] Add Dart_HintFreed to the embedding API.

Allows an embedder (or native extension) to inform the VM it suspects memory has become unreachable.

Bug: https://github.com/dart-lang/sdk/issues/42078
Change-Id: I977e14fbe760fd4b5a0cc68fd010561a66c71899
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150503
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak
2020-08-12 18:21:36 +00:00
committed by commit-bot@chromium.org
parent 91ed534139
commit ca169d010e
7 changed files with 79 additions and 6 deletions
+12
View File
@@ -1140,6 +1140,18 @@ DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate);
*/
DART_EXPORT void Dart_KillIsolate(Dart_Isolate isolate);
/**
* Notifies the VM that the embedder expects |size| bytes of memory have become
* unreachable. The VM may use this hint to adjust the garbage collector's
* growth policy.
*
* Multiple calls are interpreted as increasing, not replacing, the estimate of
* unreachable memory.
*
* Requires there to be a current isolate.
*/
DART_EXPORT void Dart_HintFreed(intptr_t size);
/**
* Notifies the VM that the embedder expects to be idle until |deadline|. The VM
* may use this time to perform garbage collection or other tasks to avoid