Board index » delphi » Errors on Win98 (WinNT and 2000 work fine)

Errors on Win98 (WinNT and 2000 work fine)

Hello

We have some serious problems with our EXE (compiled with Delphi 5 and SP1)
on Windows 98 PC's. On Windows NT or Windows 2000 everything is working
fine.

Because one of our EXE's is almost 14 Mb we had to make some BPL because
such a big EXE won't start on Win98.

When we tested this EXE on Win98 (second release) we got some Access
violations (in Kernel32.EXE) and Exceptions (EOutOfResources). More or less
RAM doesn't seam to be a solution. We use a Oracle database but it makes no
difference if it is version 8.0.4, 8.1.5, client or personal.

Because some of these errors mentioned some of our BPL's, we tested another
smaller EXE (6 Mb) without BPL's but the errors returned.

Has someone had these problems when working on Windows 98 ? Is this a
Windows 98 or a Delphi problem ? Are there solutions ?

Appreciate any help.

Stefan

Stefan Cruysberghs
stefa...@yucom.be
http://bewoner.antwerpen.be/stefancr

 

Re:Errors on Win98 (WinNT and 2000 work fine)


The amount of GDI resources has nothing to do with the physical memory
installed. Also, the segments in a .exe executables load on demand, so any
Windows system should be able to start a 14MB executable.

You have to modify your application to use less resources. Here are some
pointers:
- Don't auto-create your forms (Project | Options | Auto-create forms).
Instead, create them if you want to use them and free them if you are done.
- Don't put to many controls on a single form. Move some additional
information to sub-form that are only created if you user want to view the
information.
- Don't auto-open all your database tables on start-up. Put the tables on
the forms that actually use the information and open them if the form is
created and close them if the form is destroyed.

"Stefan Cruysberghs" <stefa...@yucom.be> schreef in bericht
news:wi8k5.28$Rk5.657@nreader1.kpnqwest.net...

Quote
> Hello

> We have some serious problems with our EXE (compiled with Delphi 5 and
SP1)
> on Windows 98 PC's. On Windows NT or Windows 2000 everything is working
> fine.

> Because one of our EXE's is almost 14 Mb we had to make some BPL because
> such a big EXE won't start on Win98.

> When we tested this EXE on Win98 (second release) we got some Access
> violations (in Kernel32.EXE) and Exceptions (EOutOfResources). More or
less
> RAM doesn't seam to be a solution. We use a Oracle database but it makes
no
> difference if it is version 8.0.4, 8.1.5, client or personal.

> Because some of these errors mentioned some of our BPL's, we tested
another
> smaller EXE (6 Mb) without BPL's but the errors returned.

> Has someone had these problems when working on Windows 98 ? Is this a
> Windows 98 or a Delphi problem ? Are there solutions ?

> Appreciate any help.

> Stefan

> Stefan Cruysberghs
> stefa...@yucom.be
> http://bewoner.antwerpen.be/stefancr

Re:Errors on Win98 (WinNT and 2000 work fine)


"Stefan Cruysberghs" <stefa...@yucom.be> skrev i melding
news:wi8k5.28$Rk5.657@nreader1.kpnqwest.net...

Quote
> Hello

> We have some serious problems with our EXE (compiled with Delphi 5 and SP1)
> on Windows 98 PC's. On Windows NT or Windows 2000 everything is working
> fine.

> Because one of our EXE's is almost 14 Mb we had to make some BPL because
> such a big EXE won't start on Win98.

> When we tested this EXE on Win98 (second release) we got some Access
> violations (in Kernel32.EXE) and Exceptions (EOutOfResources). More or less
> RAM doesn't seam to be a solution. We use a Oracle database but it makes no
> difference if it is version 8.0.4, 8.1.5, client or personal.

> Because some of these errors mentioned some of our BPL's, we tested another
> smaller EXE (6 Mb) without BPL's but the errors returned.

> Has someone had these problems when working on Windows 98 ? Is this a
> Windows 98 or a Delphi problem ? Are there solutions ?

It sounds like your application occupies far too much Windows resources, the
EAccessViolation and EOutOfResources points in this direction. To be able to
create a 14 Mb .exe file, you have to have put a lot of graphics or other big
objects in designtime. This is asking for trouble, if not done with
raffinement.
In a way, it's a Delphi problem - you end up with this trouble when adding a
large number of forms to your project and let them all be created upon
startup and freed first on termination. Although using a few hundred Mb's of
RAM wouldn't necessarily be a problem, creating a large number of controls
is. The GDI resources (window handles, canvases, bitmaps, brushes, etc.) are
limited and more RAM doesn't help.

There are a few things you should do:
1. Don't create forms before you need them, and as a general rule - free them
when they close. One easy way to accomplis this, is shown here:

  TForm1 = class(TForm)
  ...
    procedure Form1FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Form1FormDestroy(Sender: TObject);
  ....
  end;

  procedure OpenForm1;

var
  Form1: TForm1;

procedure OpenForm1;
begin
  if Form1 = nil then
    Form1:=TForm1.Create(Application); // Only create if not allready
existing...
  Form1.Show;
end;

procedure TForm1.Form1FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action:=caFree; // Forces form destruction when closing it...
end;

procedure TForm1.Form1FormDestroy(Sender: TObject);
begin
  Form1:=nil; // You need this for OpenForm; procedure...
end;

2. Remove the form from Auto-create forms in Project | Options | Forms
dialog.

... now this form only occupies resources while actually visible. The
problem, of course, may be that you loose all information kept by objects in
this form. No way around this other than saving the information and restoring
the form's "state" in code.

Start with the non-essential forms, because here you loose little from doing
it this way. More complex, frequently used forms may then be used as is,
hopefully.

Additionally, you may have problems with memory leaks, that is, creating the
same objects again and again without freeing them after use. There are quite
a few tools around (BoudsChecker, MemProof & more) to check for mamory leaks.

An application using more than, say, 20% of Windows' resources (check with
Resource Meter in Windows Accessories menu) represents potential trouble.

Good luck !

--
Bjoerge Saether
Consultant / Developer
Asker, Norway
bsaether.removet...@online.no (remove the obvious)

Re:Errors on Win98 (WinNT and 2000 work fine)


When you are only using modal forms (or some modal forms) try this:
When I need a form (I removed them all (but not the main) form from the
auto-create forms list) I simply use this code:

procedure TFrmUserForm1.Button1Click(Sender: TObject);
begin
  Application.CreateForm(TfrmUserForm2, frmUserForm3); //Create the form
  frmSettings.ShowModal; // Bring it up
  frmSettings.Free; // Free (Destroy it) After use
end;

BEWARE: this only works with modal forms!

--
uws
superuser (at) noxs (dot) nl

Quote
"Bj?rge S?ther" <REMOVE_bsaether@THIS_online.no> wrote in message

news:Md9k5.4314$aK5.72477@news1.online.no...
Quote
> There are a few things you should do:
> 1. Don't create forms before you need them, and as a general rule - free
them
> when they close. One easy way to accomplis this, is shown here:

>   TForm1 = class(TForm)
>   ...
>     procedure Form1FormClose(Sender: TObject; var Action: TCloseAction);
>     procedure Form1FormDestroy(Sender: TObject);
>   ....
>   end;

>   procedure OpenForm1;

> var
>   Form1: TForm1;

> procedure OpenForm1;
> begin
>   if Form1 = nil then
>     Form1:=TForm1.Create(Application); // Only create if not allready
> existing...
>   Form1.Show;
> end;

> procedure TForm1.Form1FormClose(Sender: TObject; var Action:
TCloseAction);
> begin
>   Action:=caFree; // Forces form destruction when closing it...
> end;

> procedure TForm1.Form1FormDestroy(Sender: TObject);
> begin
>   Form1:=nil; // You need this for OpenForm; procedure...
> end;

> 2. Remove the form from Auto-create forms in Project | Options | Forms
> dialog.

Other Threads