Board index » delphi » EOutOfResources

EOutOfResources

Hi!

I have written an application in delphi 1. Now i'm up to an new release. I
have
added some forms (none is autocreated) to the program. Now when I'm running
on a Windows 95 machine I get the following exception:

Project Pagero.exe raised exception class EOutOfResources with message
'Cannot create window'. Process stopped.

This error occures when I try to do Myform.showmodal. The dialog that I'm
trying
to open is not changed since the last (working) release. I thought I had ran
out of window handles but everything works fine on a Windows 3.11 machine
(and on NT 4.0 too) which I think have less handles than Win 95.

I have added some code to my main form but no new controls and as I said no
new autocreated forms.

Any suggestions please let med know

Regards
Hans B?rjesson
ha...@diamo.se

 

Re:EOutOfResources


Quote
> I have written an application in delphi 1. Now i'm up to an new release. I
> have
> added some forms (none is autocreated) to the program. Now when I'm running
> on a Windows 95 machine I get the following exception:

> Project Pagero.exe raised exception class EOutOfResources with message
> 'Cannot create window'. Process stopped.

_snip_

Hans,

if you are using lots of Tedit and/or TComboboxes the problem may not be
window handles but local heap space. These two controls use the local heap to
store their content. The local heap can occupy any space left in your 64K data
segment after static data and stack have been taken care of. Your additions
certainly added to the static data so you now have less local heap left.
Try to reduce your stack a bit, if this ameliorates the problem it is indeed
the local heap at fault. In this case you should perhaps try to reduce the
static data size (global variables, typed constants, pchar constants) since
reducing the stack size is chancy business.

Peter Below (TeamB)  100113.1...@compuserve.com)

Re:EOutOfResources


Thank you Peter for your answer!

Yes I have a lot of TEdit and combos.

I recently tried to upgrade my reports in my applicaton from Quickreport1
to Quickreport2 and I read in the readme file that I should increase the
stack
size to 40000 (it was only 18000 before). I had some problems with QR2 so
I switched back to QR1 but I forgot to change back the stacksize.
I now had
Heapsize  20000
Stacksize 40000

My guess is that the heap is growing so the heap+stack> 64k. When
I changed the stacksize to 20000 everything worked fine (it is dangerous to
change the stack size but the last version of the program had 18000 in stack
size and is running on ~2000 machines and I have not added that much since
then).

In Delphi you can set the heap/stack size under Options/Project. If you set
stacksize = 10000
heapsize = 10000
is it possible that the stack and/or the heap can grow over 10000 (there is
a lot of memory unused until you reach the 64k)? In other words are these
sizes only "start sizes" that can increase over time?

Regards
/Hans B?rjesson
Peter Below <100113.1...@compuserve.com> skrev i meddelandet ...

Quote
>> I have written an application in delphi 1. Now i'm up to an new release.
I
>> have
>> added some forms (none is autocreated) to the program. Now when I'm
running
>> on a Windows 95 machine I get the following exception:

>> Project Pagero.exe raised exception class EOutOfResources with message
>> 'Cannot create window'. Process stopped.

>_snip_

>Hans,

>if you are using lots of Tedit and/or TComboboxes the problem may not be
>window handles but local heap space. These two controls use the local heap
to
>store their content. The local heap can occupy any space left in your 64K
data
>segment after static data and stack have been taken care of. Your additions
>certainly added to the static data so you now have less local heap left.
>Try to reduce your stack a bit, if this ameliorates the problem it is
indeed
>the local heap at fault. In this case you should perhaps try to reduce the
>static data size (global variables, typed constants, pchar constants) since
>reducing the stack size is chancy business.

>Peter Below (TeamB)  100113.1...@compuserve.com)

Re:EOutOfResources


Hans,

the data segment cannot grow > 64K size. The stack size you specify is
exactly what the app will get (16-20K are usually plenty, unless you use
recursive algorithms or large local variables) and it is unable to grow
since it is wedged in between static data and local heap. The local heap
size you specify is a minimum, it will grow to fill the available space if
necessary, so can start out with a smaller value like 4 or 8 K here without
problems.

Peter Below (TeamB)  100113.1...@compuserve.com)

Other Threads