Re: Memory issue
On Aug 11, 2:01 pm, "Alf P. Steinbach" <al...@start.no> wrote:
[...]
In summary, standard C++ memory exhaustion detection is
unreliable on Linux and in general unreliable on Windows. ;-)
There are several issues. First, if you're writing important
software, it's not unreasonable to request that the client
configure his machine in consequence. Which may mean turning
off features of the "default configuration" if they can cause
problems. (See "man sysctl" and the variable
vm.overcommit_memory under Linux. Balog has already explained
the necessary steps under Windows. Solaris works correctly "out
of the box".)
Second, there is a difference: as far as I can tell, windows
will report the error to you. The machine may become very, very
slow (as did early Solaris), but it still works, and you still
get an std::bad_alloc. Under Linux, unless you've reconfigured
vm.overcommit_memory, no. You get no indication of a possible
error---the program just crashes.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34