Skip to content

High memory usage when building AsmResolver outputs due to no sharing #75

@SamboyCoding

Description

@SamboyCoding

When building AsmResolver assemblies, Constant objects are not shared (realistically we only need one of each type-value pair), resulting in thousands of duplicate objects being created and massively increasing memory usage.

E.g. a method with 64 parameters (which does happen with VRC!) each of which has a default value, may result in 64 constants being created, even if most of those constants are the same (e.g. the null constant, Class/00 00 00 00).

This could probably be alleviated, at least for the null constant, and some common other ones like integer zero, boolean values, etc, by caching these constant values, significantly reducing memory pressure. Sharing between assemblies should not be a problem.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions