Skip to content

Instantly share code, notes, and snippets.

@benjaminp
Created May 9, 2018 21:58
Show Gist options
  • Save benjaminp/23206c874edd4b2a61b9d31a59ca79d9 to your computer and use it in GitHub Desktop.
Save benjaminp/23206c874edd4b2a61b9d31a59ca79d9 to your computer and use it in GitHub Desktop.
a Bazel memory regression
The regression can be demonstrated with the workspace in this Gist and Bazel 0.11.1 and Bazel 0.13:
$ ../bazel-0.11.1/output/bazel build --nobuild //:my-target
$ ../bazel-0.11.1/output/bazel info used-heap-size-after-gc
37MB
$ ../bazel-0.13.0/output/bazel build --nobuild //:my-target
$ ../bazel-0.13.0/output/bazel info used-heap-size-after-gc
42MB
load(':lots_of_runfiles.bzl', 'lots_of_runfiles')
lots_of_runfiles(name = 'my-target')
def _lots_of_runfiles(ctx):
empty = ctx.actions.declare_file('dummy')
ctx.actions.write(content='', output=empty)
template = 'ponderously/long/filesystem/path/which/becomes/one/symlink/in/the/runfiles/tree/%s'
symlinks = {
template % (i,): empty
for i in range(100000)
}
return [DefaultInfo(runfiles=ctx.runfiles(symlinks=symlinks))]
lots_of_runfiles = rule(implementation=_lots_of_runfiles)
# This page intentionally left blank
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment