Skip to content

Commit

Permalink
Avoid calling ByteStore.release() with an empty set
Browse files Browse the repository at this point in the history
Change-Id: I5ca8b8acc5074d34dba3d01c0841f4c755634518
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283965
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Jaime Wren <jwren@google.com>
  • Loading branch information
jwren committed Feb 20, 2023
1 parent f193356 commit abaf24e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/analyzer/lib/src/dart/micro/resolve_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -496,13 +496,17 @@ class FileResolver {
);

// Release the linked data, the reference count is `>= 1`.
byteStore.release(linkedKeysToRelease);
if (linkedKeysToRelease.isNotEmpty) {
byteStore.release(linkedKeysToRelease);
}
}

/// Releases from the cache and clear [removedCacheKeys].
void releaseAndClearRemovedIds() {
byteStore.release(removedCacheKeys);
removedCacheKeys.clear();
if (removedCacheKeys.isNotEmpty) {
byteStore.release(removedCacheKeys);
removedCacheKeys.clear();
}
}

/// Remove cached [FileState]'s that were not used in the current analysis
Expand Down

0 comments on commit abaf24e

Please sign in to comment.