Board index » cppbuilder » Resources consumption on Win98

Resources consumption on Win98


2004-06-30 03:00:45 PM
cppbuilder1
Hallo,
I'm posting here because I couldn't decide on a better newsgroup. We
recently tried to run our (large) application on a Win98 machine and it
crashed with a "A call to an OS function failed" message.
After a little web searching we came to the conclusion that the problem
is due to the exhaustion of system resources. Is there anything that can
be done about it, that does not involve reengineering the application?
Unfortunately about 400 out of 2000 target machines are still running
Win98, so it is highly desirable not to have to upgrade them all at the
same time.
Thank you!
Nicola
P.S. Don't you find it refreshing to read something totally unrelated to
open letters and the future of BCB ;-)
--
Nicola Musatti
Team Thai Kingdom
 
 

Re:Resources consumption on Win98

Quote
Hallo,
I'm posting here because I couldn't decide on a better newsgroup. We
recently tried to run our (large) application on a Win98 machine and it
crashed with a "A call to an OS function failed" message.

After a little web searching we came to the conclusion that the problem
is due to the exhaustion of system resources. Is there anything that can
be done about it, that does not involve reengineering the application?

Unfortunately about 400 out of 2000 target machines are still running
Win98, so it is highly desirable not to have to upgrade them all at the
same time.
Make atleast sure its the second edition of 98 I wouldn't take the
trouble to make it work on the first 98 version. If you allready havethe
second edition on these machine you will have to check your program. In
this case it will be interesting which type of resources are causing the
problem. File handles, memory, gdi? The limits on these items are much
lower on 98 then on NT/2000/XP so if you forget to close handles you
will run out of them much sooner.
Eelke
 

Re:Resources consumption on Win98

"Nicola Musatti" < XXXX@XXXXX.COM >wrote in message
Quote
After a little web searching we came to the conclusion that
the problem is due to the exhaustion of system resources.
Correct.
Quote
Is there anything that can be done about it, that does not involve
reengineering the application?
Probably not. You need to lower your resource usage in general. Without
knowing how your program is actually set up, I would guess that most of your
resource usage is probably in your GUI design.
Gambit
 

{smallsort}

Re:Resources consumption on Win98

Nicola Musatti < XXXX@XXXXX.COM >wrote:
Quote
Is there anything that can
be done about it, that does not involve reengineering the application?
Easiest path is to upgrade the W98 systems to XP. If that is not
possible (and keeping in mind that I haven't had to deal with this in a
long time)...
If you have lots of forms, move them from the auto-create list and
create them on-the-fly as needed; destroy them ASAP. Start with the
forms that are easiest to change to this mechanism. If that is not
sufficient, concentrate on the forms that consume the most resources.
If you use PageControls for tabbed pages, change to TabControls. Change
each page displayed by your PageControl tabs to a frame. Create each
frame as it is displayed and destroy it when a different tab is
selected. The goal is to have only one frame object created at any given
time for each form that uses tabs.
Expanding on this, create everything you can on-the-fly and destroy it
as soon as possible.
I have no idea if this is practical in your circumstances. Even if it
is, you may not be able to reduce resource use enough to get your
project running on a non-NT OS.
 

Re:Resources consumption on Win98

Hi Nicola,
Quote
After a little web searching we came to the conclusion that the problem
is due to the exhaustion of system resources. Is there anything that can
be done about it, that does not involve reengineering the application?
First of all, it would help to know which resources are depleted by your
app. You can use a tool like resmon (originally written in Delphi 1.02
but very helpful for Win9x OS to identify if an app is leaking or using
too much resources).
Once you know the problem (GDI?) you can try to do something about it.
For one thing: make sure your forms aren't all autocreated, but create
them "on demand" (that might take some time to go through the app, but
at least should only impact the creation/freeing of forms, and not the
other parts). Past experience has shown that this will significantly
reduce your resource requirements (assuming you have autocreated forms,
of course ;-)
Quote
Thank you!
Nicola

P.S. Don't you find it refreshing to read something totally unrelated to
open letters and the future of BCB ;-)
Open letter? Which open letter? <ducking>
Quote
Nicola Musatti
Team Thai Kingdom
Groetjes,
Bob Swart (aka Dr.Bob - www.DrBob42.com)
--
Bob Swart Training & Consultancy (eBob42) Borland Technology Partner
Delphi Win32 & .NET training en support - IntraWeb Authorized Trainer
 

Re:Resources consumption on Win98

"Leroy Casterline" < XXXX@XXXXX.COM >wrote in message
Quote
If you use PageControls for tabbed pages, change to
TabControls. Change each page displayed by your
PageControl tabs to a frame. Create each frame as it
is displayed and destroy it when a different tab is selected.
The goal is to have only one frame object created at
any given time for each form that uses tabs.
Another thing to look for is use of windowed controls for things that
graphical components could accomplish instead, since graphical components
use fewer resources than windowed controls. For example, I had a project
once years ago that was using hundreds of TPanel instances as status lights
for various operations, since TPanel can be colored easily. But having that
many TPanels instantiated at a time took up a lot of resources. So I wrote
a custom TGraphicControl descendant component to mimic the same look and
feel that the TPanel instances for accomplishing, and overall resource usage
in the program dropped 20-odd% and the component count (and thus memory
usage) also dropped from hundreds of instances to a mere dozen or so.
Gambit
 

Re:Resources consumption on Win98

"Remy Lebeau \(TeamB\)" < XXXX@XXXXX.COM >wrote:
Quote
Another thing to look for is use of windowed controls for things that
graphical components could accomplish instead, since graphical components
Good point. I hope Nicola can get this working one way or another
without too much pain.
 

Re:Resources consumption on Win98

On 30/06/2004, Nicola Musatti wrote:
Quote
I'm posting here because I couldn't decide on a better newsgroup. We
recently tried to run our (large) application on a Win98 machine and
it crashed with a "A call to an OS function failed" message.

After a little web searching we came to the conclusion that the
problem is due to the exhaustion of system resources. Is there
anything that can be done about it, that does not involve
reengineering the application?

Unfortunately about 400 out of 2000 target machines are still running
Win98, so it is highly desirable not to have to upgrade them all at
the same time.
Can you run your app with memproof? If you don't know already, it might
help you to find out what system resource has been depleted.
--
Simon Elliott www.ctsn.co.uk
 

Re:Resources consumption on Win98

Thank you all for your suggestions. The machines in question are
portables from different suppliers, all running Windows 98 first
edition. The problem can be partly reduced by disabling the graphical
accelerator, which is acceptable, and reducing screen resolution and
depth, which is not acceptable. In both cases these workarounds don't
buy us enough; it only takes a few minutes' more work to hit the limit.
As I said there are some 400 machines located all over the country, so
we cannot really upgrade them all before rolling out our application.
According to the Windows 2000 task manager we have a very high
consumption of USER objects, we reach 3000 rather fast, and also the GDI
number is higher than any other application (e.g. BCB) but not as much
as with USER objects.
This application has something like 60 different "pages" (i.e. forms,
tabs, etc.), none of which are autocreated except the main form, but
most of which remain alive after being created. Our application makes
also a heavy use of custom shaped buttons.
I don't have further details at hand, but I can certailny find things
out if anybody has a suggestion.
Thank you again!
--
Nicola Musatti
Team Thai Kingdom
 

Re:Resources consumption on Win98

Nicola Musatti < XXXX@XXXXX.COM >writes:
[snip]
Quote
According to the Windows 2000 task manager we have a very high
consumption of USER objects, we reach 3000 rather fast, and also the
GDI number is higher than any other application (e.g. BCB) but not as
much as with USER objects.

This application has something like 60 different "pages" (i.e. forms,
tabs, etc.), none of which are autocreated except the main form, but
most of which remain alive after being created. Our application makes
also a heavy use of custom shaped buttons.
Whenever a page is hidden, stream out its state to memory and destroy
its controls. Restore its state when the page is re-created. The VCL
property system allows that. If you read the state of GUI controls
that may be hidden (hence destroyed) you may need a smart pointer that
redirects property access to the streamed VCL state instead of the
real control.
Quote
I don't have further details at hand, but I can certailny find things
out if anybody has a suggestion.
Depending on how and how much your business logic is intermixed with
your GUI, the above tactic can be implemented fast or not. If you
maintain a sane separation, it is quite easy to do.
--
Oscar