MetaMask / MetaMask/metamask-extension

Stop caching non-persisted controller state to reduce disk and potentially memory usage

Open
#26,066 2 comments 0 reactions 1 assignee Claimed by @danjm View on GitHub
external-contributor for-migration mig-epic-49-child Sev2-normal team-extension-platform type-bug
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

### What is this about?

We currently cache a lot of non-persisted controller state as persisted state. This state was meant only to be used for service worker restarts, but that doesn't happen right now due to our service worker keepalive strategy. We should stop caching this non-persisted state, which would reduce disk usage.

It's possible that reducing the size of persisted state would also reduce memory usage. I am not certain if this would hold true once we clear `getMostRecentPersistedState`, but it might, and it's a nice disk usage optimization regardless.

### Scenario

_No response_

### Design

_No response_

### Technical Details

_No response_

### Threat Modeling Framework

_No response_

### Acceptance Criteria

_No response_

### Stakeholder review needed before the work gets merged

- [X] Engineering (needed in most cases)
- [ ] Design
- [ ] Product
- [ ] QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
- [ ] Security
- [ ] Legal
- [ ] Marketing
- [ ] Management (please specify)
- [ ] Other (please specify)

### References

_No response_

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.