Skip to content

Commit 60d6052

Browse files
committed
Reduce memory overhead of systemProcess.GetMappings
1 parent f0fdab0 commit 60d6052

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

process/process.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,14 @@ func (sp *systemProcess) GetMappings() ([]Mapping, uint32, error) {
263263
}
264264
}
265265

266-
fileToMapping := make(map[string]*Mapping, len(mappings))
267-
for idx := range mappings {
268-
m := &mappings[idx]
269-
fileToMapping[m.Path.String()] = m
266+
sp.fileToMapping = make(map[string]*Mapping)
267+
for idx, m := range mappings {
268+
path := m.Path.String()
269+
if path != "" {
270+
sp.fileToMapping[path] = &mappings[idx]
271+
}
270272
}
271-
sp.fileToMapping = fileToMapping
273+
272274
return mappings, numParseErrors, nil
273275
}
274276

0 commit comments

Comments
 (0)