Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Out of memory panic
Re: Out of memory panic [message #36311 is a reply to message #36310] Sat, 19 May 2012 21:24 Go to previous messageGo to previous message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Well... maybe there's a way to cope with exhaust virtual address space, which for 32 bit is quite possible... for 64 bit is obviously impossible to reach it.
But anyways I guess that long before of exhausting the virtual address space you'll have so hard swapping slowing down your system to an unusable state.
IMHO your system will become completely irresponsive long before you reach the limit.... what would be the benefit of triggering an emergency routine then ?

Something a bit more useful would be some way to :

1- Check the amount of physical memory / swap space BEFORE start of your application

2- Check same values during app usage and taking some decision when swapped out space will grow too much, maybe popping up an alert box.

But the main problem would be to define the "too much", which may depend on other processes on your machine, which could be sleeping processes (so it's harmless for them to swap out all ram...) or active processes, which can block your system just because you used all physical ram.

So, IMHO also this solution would be almost useless.

Last possibility would be to "fix" the maximum amount you want to be used by your application and popup an alertbox when reached. On a 32 bit system, you can sau "I want the alert box on 1 GB limit" and you can be almost sure your app will behave good.
I guess that adding this to upp would be not too difficult and could be done in a couple of ways :

1) manual mode... have a function returning TOTAL amount of memory requested by your app, and you'll do a check by yourself before allocating. Easy and maybe (I didn't check...) already embedded in Upp.

2) semi-automatic mode : introduce a function like "SetMemoryLimit()" and let upp throw an exception when allocating past this one. You'll have to surround all your allocation with try... except, but I guess it'll behave bad with constructors.

3) Automatic mode... like step 2, but Upp could pop an alert box and call an user function when accepted, disabling temporary the memory limit. I guess this one would be the best solution.
Don't know how much overhead to upp allocators would bring....

Max
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: ...nize class
Next Topic: Value: String to int - problem or feature?
Goto Forum:
  


Current Time: Thu May 16 19:49:18 CEST 2024

Total time taken to generate the page: 0.02155 seconds