| delorie.com/archives/browse.cgi | search |
| X-Authentication-Warning: | delorie.com: mailnull set sender to djgpp-bounces using -f |
| From: | "Giovanni Spagnuolo" <spanish AT ieee DOT org> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | new[] and delete[] |
| Date: | Mon, 11 Mar 2002 09:06:35 +0000 (UTC) |
| Organization: | Mailgate.ORG Server - http://www.Mailgate.ORG |
| Lines: | 48 |
| Message-ID: | <79246c4b8f87891fe4ac8972a90fb6a1.76722@mygate.mailgate.org> |
| NNTP-Posting-Host: | pc2.diiie.unisa.it |
| X-Trace: | news.mailgate.org 1015827253 20810 193.205.164.124 (Mon Mar 11 10:06:34 2002) |
| X-Complaints-To: | abuse AT mailgate DOT org |
| NNTP-Posting-Date: | Mon, 11 Mar 2002 09:06:35 +0000 (UTC) |
| Injector-Info: | news.mailgate.org; posting-host=pc2.diiie.unisa.it; posting-account=76722; posting-date=1015827253 |
| User-Agent: | Mailgate Web Server |
| X-URL: | http://mygate.mailgate.org/mynews/comp/comp.os.msdos.djgpp/79246c4b8f87891fe4ac8972a90fb6a1.76722%40mygate.mailgate.org |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Dear friends,
I need your suggestions to solve a problem of heap memory allocation and
disallocation. To the aim of testing the memory disallocation, I've
written the following short program.
#include <conio.h>
#include <iostream.h>
#include <dpmi.h>
int main()
{
clrscr();
int N=100000;
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.
I am making a blunder?
Where I am doing wrong?
Thanks in advance.
Giovanni Spagnuolo
University of Salerno - ITALY
spanish AT ieee DOT org
--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |