mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-15 16:33:40 +00:00
builder: free LLVM objects after use
This reduces the TinyGo memory consumption when running make tinygo-test from 5.8GB to around 2GB on my laptop.
This commit is contained in:
committed by
Ron Evans
parent
ea3b5dc689
commit
777d3f3ea5
@@ -161,10 +161,12 @@ func LowerReflect(mod llvm.Module) {
|
||||
})
|
||||
|
||||
// Assign typecodes the way the reflect package expects.
|
||||
uintptrType := mod.Context().IntType(llvm.NewTargetData(mod.DataLayout()).PointerSize() * 8)
|
||||
targetData := llvm.NewTargetData(mod.DataLayout())
|
||||
defer targetData.Dispose()
|
||||
uintptrType := mod.Context().IntType(targetData.PointerSize() * 8)
|
||||
state := typeCodeAssignmentState{
|
||||
fallbackIndex: 1,
|
||||
uintptrLen: llvm.NewTargetData(mod.DataLayout()).PointerSize() * 8,
|
||||
uintptrLen: targetData.PointerSize() * 8,
|
||||
namedBasicTypes: make(map[string]int),
|
||||
namedNonBasicTypes: make(map[string]int),
|
||||
arrayTypes: make(map[string]int),
|
||||
|
||||
Reference in New Issue
Block a user