Nic wrote:
> AFAIK its a windows thing - windows minimizes its working set when
> you minimize the app, 'cos you are not interacting with it, so it
> doesn't have
Not purely a Windows things. It's underdocumented and I don't
recall the "why" details, but a Delphi-related "fixer" unit was
published for it two years back. It's small, so the code is below.
Usage: put TrimMem in your DPR's uses clause, high up (this
affects how much memory it can "release"). And (I no longer recall
if this is necessary as well, but certainly doesn't hurt!) call
TrimMem.TrimWorkingSet after Application.Initialize in your dpr's
main block.
IIRC, make, register and install a package which contains both the
units below and it helps Delphi's *own* footprint as well!
== source of RegTrim.pas
unit RegTrim;
interface
procedure Register;
implementation
uses
TrimMem;
procedure Register;
begin
TrimMem.TrimWorkingSet;
end;
end.
== source of trimmem.pas
unit TrimMem;
//
// Code courtesy of Roy Nelson ([EMAIL PROTECTED]),
// Inprise European Professional Support
//
// Call TrimWorkingSet from you project file or from a package
// to reduce the memory overhead - note that this will only work
// on Windows NT.
//
// From Delphi Magazine article "Slimming the fat off your Apps"
// by Hallvard Vassbotn, [EMAIL PROTECTED]
//
interface
procedure TrimWorkingSet;
implementation
uses
Windows,
SysUtils;
procedure TrimWorkingSet;
var
MainHandle : THandle;
begin
MainHandle := OpenProcess(PROCESS_ALL_ACCESS, false,
GetCurrentProcessID);
SetProcessWorkingSetSize(MainHandle,DWORD(-1),DWORD(-1));
CloseHandle(MainHandle);
end;
end.
cheers,
peter
============================================
Peter Hyde, WebCentre Ltd & SPIS Ltd, Christchurch, New Zealand
* Web automation for online periodicals: http://TurboPress.com
* TurboNote+: http://TurboPress.com/tbnote.htm
-- easy, small, handy onscreen sticky notes
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"