IntersectMBO / IntersectMBO/plutus

If it is safe, "free" memory for CEK machine frames when they are no longer on the stack

Open
#6,108 0 comments 0 reactions 0 assignees View on GitHub
Costing Evaluation Internal status: triaged
Dominant language
Haskell
Stars
1.6k
Forks
508
Avg merge
3d 10h
Merged PRs (30d)
22

Description

At the moment we bill the user for some memory when we allocate a new frame. We could “release” that memory when we no longer hold on to the stack frame. This would make programs use some amount less memory, and might be relevant for programs that have deep call stacks.

It’s relatively unlikely that this will actually make things directly better for users, however. At the moment memory and cpu are almost perfectly correlated, so if we make the memory limit not binding, then the cpu limit probably will be.

Still, it might be more accurate, which is nice.

Notes:

I think this would be accurate and safe, but it might mess up the careful balancing of costs that’s being done by the node folks at the moment.

The other issue is that it’ll require redoing some of how we track costs for machine steps. Memory for frames should get released when we take a “return” step, and currently we only do costing when we take a “compute” step. The book-keeping overhead could easily swamp the benefits unless we come up with a clever way of doing it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.