delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/03/11/06:10:18

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Date: Mon, 11 Mar 2002 13:07:31 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Giovanni Spagnuolo <spanish AT ieee DOT org>
cc: djgpp AT delorie DOT com
Subject: Re: new[] and delete[]
In-Reply-To: <79246c4b8f87891fe4ac8972a90fb6a1.76722@mygate.mailgate.org>
Message-ID: <Pine.SUN.3.91.1020311130512.17471C-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Mon, 11 Mar 2002, Giovanni Spagnuolo wrote:

>         cout<<"before allocation"<<endl;
>         cout<<_go32_dpmi_remaining_physical_memory()<<endl;
>         cout<<_go32_dpmi_remaining_virtual_memory()<<endl<<endl;
>         
>         int * v = new int[N];
>         
>         cout<<"after allocation"<<endl;
>         cout<<_go32_dpmi_remaining_physical_memory()<<endl;
>         cout<<_go32_dpmi_remaining_virtual_memory()<<endl<<endl;
>         
>         delete [] v;
>         
>         cout<<"after disallocation"<<endl;
>         cout<<_go32_dpmi_remaining_physical_memory()<<endl;
>         cout<<_go32_dpmi_remaining_virtual_memory()<<endl<<endl;
> 
>         return 0;
> }
> 
> Nevertheless it seems that the disallocated memory does not become newly
> free.

See section 15.2 of the DJGPP FAQ list, it explains why this is expected 
behavior.

What are you trying to accomplish, really?  Since this is a toy program, 
I assume you have something more serious in mind; if you tell what that 
is, perhaps someone can suggest a solution.

- Raw text -


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