Or carefully track memory usage and compare it to remaining space.
In other words, malloc should "reserve" vm space and this reservation
should be honored by other mallocs or file operations (!) and that
should be system wide. If that is true, then in the above example
NewHandle(.9GB) will fail and NewHandle(.4GB) will succeed.
And of course, there are disadvantages to that as well. What if .9GB is
allocated and only .4GB of it is used (for whatever reason). And what
if .4GB was available on disk when the handle was requested but .9GB
becomes free later (who knows why). And of course, the ever popular App
A requests .4GB that it will use over the course of an hour, while App
B needs 1MB that it will need right now but will be done with in 30
seconds. Why should App B be starved because App A preallocated?
In the end, there is no perfect VM allocation strategy, they all have
some horrible edge case where the system has to throw up it's hands and
request user action to resolve the issue. Of course, the user can just
decide to get the biggest HD available and make the problem mostly
transparent if it bothers them that often. Again, an imperfect solution
to an imperfect world :).
--
Reality is what, when you stop believing in it, doesn't go away.
Failure is not an option. It is a privilege reserved for those who try.
David Duncan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden