Refactor Phase 2: HashSet types, leaking naming, subLeakedByParent map

- foundLeakingObjectIds / unprocessedLeakingIds: use HashSet<Long> instead
  of LongScatterSet (simpler API, .size not .size(), isNotEmpty() etc.)
- Rename all 'seed' variables to 'leaking' (currentLeakingId,
  unprocessedLeakingIds) for clarity
- Rename subLeakedObjectPaths → subLeakedObjectsByParentLeakedObject in
  PathFindingResults, PrioritizingShortestPathFinder, RealLeakTracerFactory
- Track sub-leaked objects as subLeakedByParent: Map<Long, Long>
  (sub-leaked id → parent leaked id) internally; group into
  Map<Long, List<Long>> just before return
- Move break@bfsLoop (early exit when last sub-leaked found) before
  visitedSet.add so we don't visit unnecessary objects
- Sub-leaked branch falls through to the visitedSet/bfsQueue code below
  instead of duplicating it
- break/continue always on their own line for readability

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3 files changed
tree: 23a0039225a57b8abb5a40914171e7107743f36a
  1. .github/
  2. config/
  3. docs/
  4. gradle/
  5. leakcanary/
  6. object-watcher/
  7. plumber/
  8. samples/
  9. shark/
  10. .editorconfig
  11. .gitattributes
  12. .gitignore
  13. build.gradle.kts
  14. gradle.properties
  15. gradlew
  16. LICENSE.txt
  17. mkdocs.yml
  18. README.md
  19. settings.gradle
  20. shark-cli.sh
README.md

LeakCanary 🐤

A memory leak detection library for Android.

square.github.io/leakcanary

🙏 If you like LeakCanary you can show support by starring ⭐ this repository.

License

Copyright 2015 Square, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.