Skip to content

scc::memory can't be sized dynamically #73

@mekarlst

Description

@mekarlst

The scc::memory class requires the size as a template parameter, but we determine our memory sizes dynamically at runtime. As a result, we've been using scc::memory but giving each instance a worst-case constant size that is sufficient for any runtime configuration. This caused us to run into a DMI issue (see #72).

Ideally, we'd like to be able to set the size of the memory at runtime. As a workaround, I added a size override argument to the scc::memory constructor with a default value of std::numeric_limits<uint64_t>::max() and a member variable that is assigned the minimum of the constructor argument and the SIZE template parameter. Using this new member variable instead of SIZE in the implementation (e.g., in handle_operation and handle_dmi) seemed to fix our issue, although it doesn't address the overhead of allocating memory that won't be used.

I'm happy to put the workaround up as a PR, but I wanted to present this issue, in case there is a more preferred solution, such as creating a new memory component that is dynamically sized or changing scc::memory to be dynamically sized natively.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions