Skip to content

Missing inclusion of pckgName field in shallow size allocation calculation #4791

@Kouteki

Description

@Kouteki

Severity: Informational

Description

In mempackage_type:gnovm/pkg/gnolang/alloc.go:347–364, the shallow size of a package value is estimated by accumulating the memory usage of its FNames, FBlocks, and fBlocksMap fields. The calculation includes string lengths and pointer sizes as appropriate, and returns the total estimated allocation.

However, the packagName field, which is a string and part of the package’s shallow structure is not accounted for in this allocation calculation. This omission results in an underestimation of the memory used by the package value.

Recommendation

We recommend including the pckgName field in the shallow size computation by adding its length plus allocPkgName to the total allocation estimate. This ensures consistency and correctness when calculating memory overhead for package values

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions