Board index » delphi » System Resources, User Resources, & GDI Resources

System Resources, User Resources, & GDI Resources

Can anyone point me to an article that explains what these "resources" are.
What components "use up" resources? I try to create and free components only
on an as-needed basis, but still seem to use a lot of them.  It seems that
programs crash when available resources drop to 0%. Are there certain
techniques in Delphi that use fewer resources?
 

Re:System Resources, User Resources, & GDI Resources


Windows 9x has a limit on user and GDI resources (the number for system
resources is just the lowest value of either user or GDI resources).
All screen elements (controls) require a Windows handle to identify it an
pass messages from/to it. These handles are stored on the user resource
stack. The Windows 9x user resource stack is 64Kb, so it can only hold 16Kb
(4-byte) handles. Windows NT/2000 doesn't have this limit.
The GDI stack on Windows 9x is also 64Kb, and is used to store handles for
drawing to the screen (correct me if I'm wrong).

I haven't seen a program yet that ran out of GDI resources, so I'll
concentrate on reducing user resource usage:
- Don't auto-create forms (Project | Options... | Forms | Auto-create
forms). Instead, create forms if you need them and destroy them if done.
- Don't put to many controls on a single form. Instead, move less used
controls to a separate form that can be shown if e.g. a button is pressed.
- Avoid using TComboBox (and TDBComboBox etc.). These controls use 3 handles
instead of 1.

"Bob Richardson" <b...@whidbey.com> schreef in bericht
news:tftklgq6cmkfb8@corp.supernews.com...

Quote
> Can anyone point me to an article that explains what these "resources"
are.
> What components "use up" resources? I try to create and free components
only
> on an as-needed basis, but still seem to use a lot of them.  It seems that
> programs crash when available resources drop to 0%. Are there certain
> techniques in Delphi that use fewer resources?

Re:System Resources, User Resources, & GDI Resources


Quote
"M.H. Avegaart" <avega...@NOSPAMmccomm.nl> wrote in message
> - Avoid using TComboBox (and TDBComboBox etc.). These controls use 3
handles
> instead of 1.

I know this is a standard recommendation but I've yet to figure out how to
replace them nicely - short of using a 3rd party combo that doesn't use so
many handles.

Other Threads