Skip to content

Commit

Permalink
pre-alloc asm.Instructions when loading functions
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Cacheux <paul.cacheux@datadoghq.com>
  • Loading branch information
paulcacheux committed Nov 7, 2023
1 parent 463c43e commit 8625e66
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion elf_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ func (ec *elfCode) loadFunctions(section *elfSection) (map[string]asm.Instructio
r := bufio.NewReader(section.Open())

// Decode the section's instruction stream.
var insns asm.Instructions
insns := make(asm.Instructions, 0, section.Size/asm.InstructionSize)
if err := insns.Unmarshal(r, ec.ByteOrder); err != nil {
return nil, fmt.Errorf("decoding instructions for section %s: %w", section.Name, err)
}
Expand Down

0 comments on commit 8625e66

Please sign in to comment.