<#20274 High memory use in Golang > Issue created ...
# github-notifications
c
#20274 High memory use in Golang Issue created by JettJones Describe the bug Building our golang projects uses a lot of memory - leading to pantsd exits / OOM kills. Because of this, we get slow build and rebuilds due to a loss of caching, or other crashes from OOM. Pants version 2.18.1 OS My setup is on Linux (Ubuntu 22.04) Additional info Likely similar to #19053 from earlier pants releases. I uploaded a simplified reproduction here: https://github.com/JettJones/go-include • main.go does ~nothing, most of the issue comes from requiring modules. • in this reproduction, temporal client / server are the largest module sets. In our internal work, more requirements increase the impact of this issue. Here is the memory summary of
pants --stats-memory-summary check ::
& debug logs gist ``` 113329.41 [INFO] Memory summary (total size in bytes, count, name): 48 1 pants.backend.go.dependency_inference.AllGoModuleImportPathsMappings 48 1 pants.backend.go.dependency_inference.GoModuleImportPathsMapping 48 1 pants.backend.go.dependency_inference.GoModuleImportPathsMappings 48 1 pants.backend.go.goals.check.GoCheckRequest 48 1 pants.backend.go.subsystems.golang.GolangSubsystem 48 1 pants.backend.go.subsystems.golang.GolangSubsystem.EnvironmentAware 48 1 pants.backend.go.subsystems.gotest.GoTestSubsystem 48 1 pants.backend.go.target_type_rules.FirstPartyGoModuleImportPathsMappingsHook 48 1 pants.backend.go.target_type_rules.GenerateTargetsFromGoModRequest 48 1 pants.backend.go.target_type_rules.GoImportPathMappingRequest 48 1 pants.backend.go.target_type_rules.InferGoPackageDependenciesRequest 48 1 pants.backend.go.util_rules.build_pkg.CheckForGolangAssemblyRequest 48 1 pants.backend.go.util_rules.build_pkg.CheckForGolangAssemblyResult 48 1 pants.backend.go.util_rules.build_pkg.SetupAsmCheckBinary 48 1 pants.backend.go.util_rules.build_pkg_target._ResolveStdlibEmbedConfigRequest 48 1 pants.backend.go.util_rules.build_pkg_target._ResolveStdlibEmbedConfigResult 48 1 pants.backend.go.util_rules.cgo.CGoCompilerWrapperScript 48 1 pants.backend.go.util_rules.cgo_binaries.CGoBinaryPathRequest 48 1 pants.backend.go.util_rules.first_party_pkg.FallibleFirstPartyPkgAnalysis 48 1 pants.backend.go.util_rules.first_party_pkg.FallibleFirstPartyPkgDigest 48 1 pants.backend.go.util_rules.first_party_pkg.FirstPartyPkgAnalysisRequest 48 1 pants.backend.go.util_rules.first_party_pkg.FirstPartyPkgDigestRequest 48 1 pants.backend.go.util_rules.first_party_pkg.FirstPartyPkgImportPath 48 1 pants.backend.go.util_rules.first_party_pkg.FirstPartyPkgImportPathRequest 48 1 pants.backend.go.util_rules.go_bootstrap.GoBootstrap 48 1 pants.backend.go.util_rules.go_mod.NearestAncestorGoModRequest 48 1 pants.backend.go.util_rules.go_mod.NearestAncestorGoModResult 48 1 pants.backend.go.util_rules.goroot.GoRoot 48 1 pants.backend.go.util_rules.implicit_linker_deps.SdkImplicitLinkerDependenciesHook 48 1 pants.backend.go.util_rules.link.LinkerSetup 48 1 pants.backend.go.util_rules.link_defs.ImplicitLinkerDependencies 48 1 pants.backend.go.util_rules.pkg_analyzer.PackageAnalyzerSetup 48 1 pants.backend.go.util_rules.sdk.GoSdkRunSetup 48 1 pants.backend.go.util_rules.third_party_pkg.AllThirdPartyPackages 48 1 pants.backend.go.util_rules.third_party_pkg.AllThirdPartyPackagesRequest 48 1 pants.backend.go.util_rules.third_party_pkg.ModuleDescriptors 48 1 pants.backend.go.util_rules.third_party_pkg.ModuleDescriptorsRequest 48 1 pants.backend.project_info.filter_targets.FilterSubsystem 48 1 pants.backend.python.goals.lockfile.PythonSyntheticLockfileTargetsRequest 48 1 pants.backend.python.subsystems.setup.PythonSetup 48 1 pants.base.build_root.BuildRoot 48 1 pants.build_graph.build_configuration.BuildConfiguration 48 1 pants.core.goals.check.Check 48 1 pants.core.goals.check.CheckResults 48 1 pants.core.goals.check.CheckSubsystem 48 1 pants.core.util_rules.distdir.DistDir 48 1 pants.core.util_rules.environments.AllEnvironmentTargets 48 1 pants.core.util_rules.environments.DockerPlatformFieldDefaultFactoryRequest 48 1 pants.core.util_rules.environments.EnvironmentNameRequest 48 1 pants.core.util_rules.environments.EnvironmentTarget 48 1 pants.core.util_rules.environments.EnvironmentsSubsystem 48 1 pants.core.util_rules.search_paths.ValidateSearchPathsRequest 48 1 pants.core.util_rules.search_paths.ValidatedSearchPaths 48 1 pants.core.util_rules.source_files.SourceFiles 48 1 pants.core.util_rules.source_files.SourceFilesRequest 48 1 pants.core.util_rules.system_binaries.BashBinary 48 1 pants.core.util_rules.system_binaries.BinaryPath 48 1 pants.engine.console.Console 48 1 pants.engine.env_vars.PathEnvironmentVariable 48 1 pants.engine.environment.ChosenLocalEnvironmentName 48 1 pants.engine.fs.Workspace 48 1 pants.engine.internals.build_files.BuildFileOptions 48 1 pants.engine.internals.build_files.OptionalAddressFamily 48 1 pants.engine.internals.dep_rules.MaybeBuildFileDependencyRulesImplementation 48 1 pants.engine.internals.graph.ResolveTargetGeneratorRequests 48 1 pants.engine.internals.graph.ResolvedTargetGeneratorRequests 48 1 pants.engine.internals.graph.SubprojectRoots 48 1 pants.engine.internals.mapper.AddressFamily 48 1 pants.engine.internals.mapper.SpecsFilter 48 1 pants.engine.internals.options_parsing._Options 48 1 pants.engine.internals.parser.BuildFilePreludeSymbols 48 1 pants.engine.internals.parser.Parser 48 1 pants.engine.internals.synthetic_targets.AllSyntheticAddressMaps 48 1 pants.engine.internals.synthetic_targets.SyntheticAddressMapsRequest 48 1 pants.engine.platform.Platform 48 1 pants.engine.streaming_workunit_handler.WorkunitsCallbackFactory 48 1 pants.engine.target.FieldDefaultFactoryResult 48 1 pants.engine.target.FieldDefaults 48 1 pants.engine.target.GeneratedTargets 48 1 pants.engine.target.RegisteredTargetTypes 48 1 pants.engine.target.TargetTypesToGenerateTargetsRequests 48 1 pants.engine.unions.UnionMembership 48 1 pants.goal.stats_aggregator.StatsAggregatorCallbackFactoryRequest 48 1 pants.goal.stats_aggregator.StatsAggregatorSubsystem 48 1 pants.init.bootstrap_scheduler.BootstrapStatus 48 1 pants.option.global_options.GlobalOptions 48 1 pants.option.global_options.KeepSandboxes 48 1 pants.option.global_options.UnmatchedBuildFileGlobs 48 2 pants.engine.env_vars.CompleteEnvironmentVars 48 2 pants.engine.internals.build_files.AddressFamilyDir 48 5 pants.base.specs.Specs 48 10859 pants.engine.environment.EnvironmentName 56 1 pants.backend.go.util_rules.go_mod.AllGoModTargets 56 1 pants.engine.streaming_workunit_handler.WorkunitsCallbackFactories 88 1 builtins.ProcessExecutionEnvironment 96 2 pants.backend.go.go_sources.load_go_binary.LoadedGoBinary 96 2 pants.backend.go.go_sources.load_go_binary.LoadedGoBinaryRequest 96 2 pants.backend.go.util_rules.build_opts.GoBuildOptions 96 2 pants.backend.go.util_rules.build_opts.GoBuildOptionsFromTargetRequest 96 2 pants.backend.go.util_rules.build_pkg.RenderEmbedConfigRequest 96 2 pants.backend.go.util_rules.build_pkg.RenderedEmbedConfig 96 2 pants.backend.go.util_rules.cgo.CGoCompileRequest 96 2 pants.backend.go.util_rules.cgo.CGoCompileResult 96 2 pants.backend.go.util_rules.cgo.SetupCompilerCmdRequest 96 2 pants.backend.go.util_rules.cgo.SetupCompilerCmdResult 96 2 pants.backend.go… pantsbuild/pants