[ddc/testing/cfe/kernel] Wire up leak testing in ddc batch testing; fix 'semi-leaks'

There's been some talks about weird failures on DDC and there was
ideas that this was caused by some sort of leak (of kernel libraries).

I haven't really found any "meaningful" leaks that should be able
to cause that.

What I have found is this:

* a temporary leak where the vm seemingly gets "one behind".
  That's fixed here by creating a class for the ddc batch compiler,
  having things in field variables etc. It shouldn't influence results.
* a leaks via https://github.com/dart-lang/sdk/issues/51317 --- but
  that's just wasted memory, I can't see how that should influence
  results.
* a leak via kernels dummy nodes --- again it shouldn't influence
  results (unless we're leaving dummy nodes in the output somewhere
  --- which, considering I'm removing that in my test by null'ing out
  the parent pointer and stuff still working I'm guessing we're not).
* another leak via some ports map after a crash, but that seems
  to go away on its own (the VM cleaning it up later than I think it
  should?). Again it shouldn't influence anything other than
  (temporary) wasted space.

I've wired up the leak testing stuff into the DDC batch mode so that
one can go into "leak test mode" by doing `export DDC_LEAK_TEST="true"`
on the terminal (I think `set DDC_LEAK_TEST="true"` on Windows).
Then one could run test.py, say

```
python3 tools/test.py -t10000 -c dartdevk --nnbd weak -m release \
  -r none --enable-asserts --no-use-sdk -j 1 co19/LanguageFeatures/
```

and attach the leak tester via

```
out/ReleaseX64/dart \
  pkg/front_end/test/vm_service_for_leak_detection.dart --dart-leak-test
```

Currently this finds - if I recall correctly - 3 leaks (I think all via
the ports map stuff), but it all goes away again on it's own, so likely
another case of the VM somehow getting "one behind".

Change-Id: Idbf057e3aedfe7b256370f90ddf72f1f8e6798a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282027
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
5 files changed
tree: 9ea7a4418ecec76f4f17b0d5d760901f8082f95f
  1. .dart_tool/
  2. .github/
  3. benchmarks/
  4. build/
  5. docs/
  6. pkg/
  7. runtime/
  8. samples/
  9. sdk/
  10. tests/
  11. third_party/
  12. tools/
  13. utils/
  14. .clang-format
  15. .gitattributes
  16. .gitconfig
  17. .gitignore
  18. .gn
  19. .mailmap
  20. .style.yapf
  21. .vpython
  22. AUTHORS
  23. BUILD.gn
  24. CHANGELOG.md
  25. codereview.settings
  26. CONTRIBUTING.md
  27. DEPS
  28. LICENSE
  29. OWNERS
  30. PATENT_GRANT
  31. PRESUBMIT.py
  32. README.dart-sdk
  33. README.md
  34. sdk_args.gni
  35. SECURITY.md
  36. WATCHLISTS
README.md

Dart

A client-optimized language for fast apps on any platform

Dart is:

  • Optimized for UI: Develop with a programming language specialized around the needs of user interface creation.

  • Productive: Make changes iteratively: use hot reload to see the result instantly in your running app.

  • Fast on all platforms: Compile to ARM & x64 machine code for mobile, desktop, and backend. Or compile to JavaScript for the web.

Dart's flexible compiler technology lets you run Dart code in different ways, depending on your target platform and goals:

  • Dart Native: For programs targeting devices (mobile, desktop, server, and more), Dart Native includes both a Dart VM with JIT (just-in-time) compilation and an AOT (ahead-of-time) compiler for producing machine code.

  • Dart Web: For programs targeting the web, Dart Web includes both a development time compiler (dartdevc) and a production time compiler (dart2js).

Dart platforms illustration

License & patents

Dart is free and open source.

See LICENSE and PATENT_GRANT.

Using Dart

Visit dart.dev to learn more about the language, tools, and to find codelabs.

Browse pub.dev for more packages and libraries contributed by the community and the Dart team.

Our API reference documentation is published at api.dart.dev, based on the stable release. (We also publish docs from our beta and dev channels, as well as from the primary development branch).

Building Dart

If you want to build Dart yourself, here is a guide to getting the source, preparing your machine to build the SDK, and building.

There are more documents on our wiki.

Contributing to Dart

The easiest way to contribute to Dart is to file issues.

You can also contribute patches, as described in Contributing.