Date: Wed, 4 Jun 1997 12:15:13 +0200 (MDT) Message-Id: <3.0.16.19970605110427.2d5f0684@hem1.passagen.se> To: djgpp AT delorie DOT com From: Peter Palotas Subject: Locking memory. Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Precedence: bulk I have 8MB of physical RAM installed on my computer (I know, it sux). I was just thinking then that the following programs would both fail to allocate that memory, but they don't... Why? Program 1: #include #include int _crt0_startup_flags = _CRT0_FLAG_LOCK_MEMORY; char buffer[1024 * 1024 * 20]; // 20MB large buffer int main(void) { cprintf("hello, world"); return 0; } Program 2: #include #include int _crt0_startup_flags = _CRT0_FLAG_LOCK_MEMORY; int main(void) { void *buffer = calloc(1024 * 1024, 20; if (buffer != NULL) cprintf("Memory allocation successful."); else cprintf("Memory allocation failed."); return 0; } Both program swap to disk hence using virtual memory. Why is that, shouldn't the crt0 flags prevent this? Isn't there a way to make sure that all memory is locked securely? // Blizzar -- blizzar AT hem1 DOT passagen DOT se -- http://hem1.passagen.se/dnt **************************************************************************** Don't tell me about the answer, 'cause then another one will come along soon I don't believe you have the answer, I've got ideas too But if you got enough naivity, and you got conviction then the answer is perfect for you! // Bad Religion - Generator, The Answer ****************************************************************************