4 ms·
> what would you do if you run out of memory while making the fourth button in a toolbar? Rollback what I’d created so far, evict caches, ask malloc to trim, t
by chrisseaton 7y ago
> what would you do if you run out of memory while making the fourth button in a toolbar?
Rollback what I’d created so far, evict caches, ask malloc to trim, try again, if that failed roll back again and ask the user to reduce the volume of application data open by closing views or documents or whatever before they try again.
But yeah it’s a lot of engineering.
- gmueckl 7y agoSo you meant to say: ignore the possibility of this happening because it is extremely unlikely, too complex to handle and your time is better spent fixing much ore serious bugs that the users report. Silly engineering like what you suggest is a waste of time. Non-critical applications that are allowed to crash (every normal desktop app) would end up overengineered and unmaintainable. Embedded systems that must give guarantees about their reliability simplify system design drastically. One of the things going out the window first is dynamic memory allocation. It has too many failure modes.
- Crinus 7y ago> ask the user You just failed to create a toolbar button, how are you going to ask a user do something if you already failed to create a tiny UI element?
- hyperman1 7y agoI guess you pre-allocate these UI elements when you start your application.