www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/04/10:29:52

Message-ID: <36DEA63E.80B5A3AC@elektro.ing.hb.se>
Date: Thu, 04 Mar 1999 16:26:54 +0100
From: "SAMUEL ALMESTRM" <EL9712 AT elektro DOT ing DOT hb DOT se>
Organization: University of Boras, Sweden
X-Mailer: Mozilla 4.05 [en] (WinNT; I)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: memory allocation
Reply-To: djgpp AT delorie DOT com

I have a problem then I first malloc a lot of memory (all available RAM)
and then I later uses the free command of that memory block I would like
it to be free, but it don't! If I once again malloc that much memory
then it is stored in the harddrive (virtual memory).
But why? I thought I had released all malloced memory?

int *test;

test = (int *) malloc(32768000);

for (i=0; i<32768; i++)
 test[i]=i;                  // just fill the memory 

free (test); 

test = (int *) malloc(32768000);

for (i=0; i<32768; i++)
 test[i]=i;                  // just fill the memory 


If I have more than 32768 Mb left then I start the program, how can it
be using virtual memory?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019