🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #2640

Re: Creating new TForm causes 'Out of Resources' error on WinXP

#2640
From: Dan Mayo
Date: Fri, 19 Jan 2007 20:28
36 lines
2845 bytes
Remy Lebeau (TeamB) wrote:

>> Is there a better way?
> 
> You already know a better way - use 'delete' instead.  There is
> nothing in your code that warrants the use of Release().


I do appreciate the help and the comments.
I was under the impression that the Release();  ProcessMessages() call 
actually fixed the problem as my code ran much much longer than it ever 
had before in this loop.

However, it does still occur.

With the straight 'delete' operator, my code lasts approximately 230 
cycles; with the Release(); ProcessMessages() operators instead of 
delete, the code goes nearly 800 cycles.  During each of these cycles 
are several hardware read/write commands, each dynamically creating and 
destroying that form; and with each cycle nearly 24k of memory is saved. 
  The data is stored in a TStringGrid.  Perhaps that is the real 
problem.  I don't quite see why since I can easily open a file and fill 
in a TStringGrid with 2x the amount of data collected during this loop 
and then dynamically create the dialog in question though. But I've been 
wrong before :)

As I said before the form in question is rather simple, and it has a 
TProgressBar, TLabel, and TButton on it; that's it.

I'm confused (1) why this is still happening, although basically Remy 
says I haven't done anything to fix the problem, which I can buy; 
however that brings me to my second confusion (2) why my code 
consistently runs much longer with the Release() than it did with just 
the delete.

Dan
Technical Details
Message-ID: <45b12a27$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <45afcda9$1@newsgroups.borland.com> <45afd2ea$1@newsgroups.borland.com> <45afd751$1@newsgroups.borland.com> <45afe953$1@newsgroups.borland.com> <45aff139$1@newsgroups.borland.com> <rgh1r2ln049empurv72i8uith6amj1hl4c@4ax.com> <45b0d38c@newsgroups.borland.com> <45b0d69a$1@newsgroups.borland.com> <45b0dfca@newsgroups.borland.com> <45b115ae@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,81568e00a202778e
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Fri, 19 Jan 2007 14:28:59 -0600
From: Dan Mayo <dmayo@dickey-john.com>
User-Agent: Thunderbird 1.5.0.9 (Windows/20061207)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Creating new TForm causes 'Out of Resources' error on WinXP
References: <45afcda9$1@newsgroups.borland.com> <45afd2ea$1@newsgroups.borland.com> <45afd751$1@newsgroups.borland.com> <45afe953$1@newsgroups.borland.com> <45aff139$1@newsgroups.borland.com> <rgh1r2ln049empurv72i8uith6amj1hl4c@4ax.com> <45b0d38c@newsgroups.borland.com> <45b0d69a$1@newsgroups.borland.com> <45b0dfca@newsgroups.borland.com> <45b115ae@newsgroups.borland.com>
In-Reply-To: <45b115ae@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 216.174.165.174
Message-ID: <45b12a27$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1169238567 216.174.165.174 (19 Jan 2007 12:29:27 -0800)
Lines: 36
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail