This doesn't sound right, I have seen the problem that linux will not use the allocated memory until it is touched, but doesn't the memory manger keep track ultimatly of all allocations (in the kernel which as all encompassing knowledge of allocations) which might include things that have not yet been written too? In some of the apps that I wrote I saw the behaviour that I could not allocate more ram and malloc fails, but never really noticed if it fails on memory that has not been touched. I do remember in TOP not seeing allocations happen until it was cleared (memset). For the critical stuff I preallocate and mlock() allocated memory to force it into ram for most of the server processes, but other processes, have run out of ram at allocation time, so I'm not sure that it won't fail just on allocation (all on linux 2.4x btw). Good food for thought...
Sandy -----Original Message----- From: Henry Miller [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 04, 2005 12:37 PM To: sqlite-users@sqlite.org Subject: RE: [sqlite] Is there any way to enable recursive triggers? On 1/4/2005 at 12:13 Sandy Ganz wrote: >What OS does not return NULL or an exception when malloc() fails or is out >of memory? OS/2. Linux kernels < 2.6. I think Windows does this too, but I'm not sure. Its harder than you might think to implement, because most OSes don't allocate memory until you WRITE to it. There are programs that take advantage of this by mallocing lots of memory, but only using a small amount. Think of large sparse arrays, you allocate a lot of memory, but only use a few bytes scattered over it. In order to implement malloc that fails the system needs to refuse to give you memory, even though it knows about unused memory (that some other process has reserved but not touched yet). Of course when malloc does not fail there are a host of other problems, eventually the OS just stops your process.