← Back to context

Comment by goalieca

7 hours ago

With dram, you have to refresh every cell within a periodic interval. Usually this is handled in hardware. It would be a crazy optimization if unused pages weren’t refreshed. There would have to be a decent amount of circuitry to decide that.

I'm not suggesting it exists, but I could plausibly see something where the range to refresh could be changed at runtime. If you could adjust refresh on your 8 GB phone in 1 GB intervals (refresh up to 1/2/4/8 GB etc; or refresh yes/no for each 1GB interval), the OS could be sure to put its memory at low addresses, and the OS could do memory compaction into lower addresses and disable refresh on higher addresses from time to time. Or ... I think there's apis for allocations for background memory vs foreground memory; if you allocate background memory at low addresses and foreground memory at high addresses, then when the OS wants to sleep, it kills the process logically and then turns off refresh on the ram ... when it wants to use it again later, it will have to zero the ram cause who knows what it'll have.

I don't work at that kind of level, so I dunno if the juice would be worth the squeeze (sleep with DRAM refresh is already very low power on phone scales), but it seems doable.