Open
Description
PackageBuilder does a lot of work to set up a PackageGraph, using analyzer's ContextCollection, which holds onto lots of stuff for all of the analyzed code. A PackageBuilder is an instance field on the Dartdoc class, but is used in exactly one place: Dartdoc.generateDocsBase, to generate the PackageGraph.
I worry that Dartdoc's PackageBuilder is not being GC'd. In any case, the API feels unclean, that it holds onto this object for one task at the beginning of doc generation. It would be better if Dartdoc.generateDocsBase instantiated the PackageBuilder. Alternatively, PackageBuilder.buildPackageGraph could create a local ContextCollection, but I think that defeats a lot of the benefit of having a separate class for building a PackageGraph.