Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: About memory usage...

  1. #11

    About memory usage...

    Um... I just compiled it in Delphi 5.0, and using the Resource Manager (under Win98SE), it appears it only takes up 1.2MB of memory. Wonder if it might also have something to do with running under NT/XP?
    My DGDev forum pascal syntax highlight settings:
    <br />[background=#FFFFFF][comment=#8080FF][normal=#000080]
    <br />[number=#C00000][reserved=#000000][string=#00C000]

  2. #12

    About memory usage...

    Mine comes out as 992K of memory usage with Delphi 5 and Win2K. Still too much, mind you. I wonder how Delphi 6 affects things...
    "All paid jobs absorb and degrade the mind."
    <br />-- Aristotle

  3. #13

    About memory usage...

    What sort of tools does everyone use to monitor system resources and profile their applications? Just interested as I've never used any myself.
    My DGDev forum pascal syntax highlight settings:
    <br />[background=#FFFFFF][comment=#8080FF][normal=#000080]
    <br />[number=#C00000][reserved=#000000][string=#00C000]

  4. #14

    About memory usage...

    I use only the XP's Task Manager, by default it doesn't show you how many handles or threads there are, but in View->Select Colums you can make it show various information, like how many I/O reads programs has done etc.

    I installed Delphi3 and tried compiling the program: the executable came slightly bigger, it's 15 kb but the memory usage dropped to 616 kb. I think that's still too much for such a small app, but much less compared to program compiled with Delphi6.

  5. #15

    About memory usage...

    I've just tried compiling the program using Delphi 7. I got a 13.5 KB app, and the runtime foot print was around 2.4MB. I tried fiddling with compiler options, and it didn't change a thing!! That is so weird. I would have expected that turning of all the debugging options would make the exe size smaller, but nope, that didn't do a thing.

  6. #16

    Re: About memory usage...

    Quote Originally Posted by Mike
    When I create a simple application like:

    snip..

    The executable is 6 kb, which is fine... But when I run the program, why an earth is takes 3 MB ram?
    Okay.. I made the same app with Delphi 6 {on a win 2k box}.

    The app took up of 808K mem when running acording to task manager.
    It was (9,216 bytes) but 16.0 KB (16,384 bytes) size on disk.
    I ran it throught code seluth and didn't find any allocated memory at all.

    Id love to know where the bloat is coming from.

    Armand.

  7. #17
    Delphic
    Guest

    About memory usage...

    ...

  8. #18

    About memory usage...

    Program SmallApp;

    function MessageBoxA(HWND: Cardinal; Msg,Title: pChar; Flags: Cardinal): Cardinal; stdcall; external 'User32.dll';
    function SetProcessWorkingSetSize(hProcess: LongWord; dwMinimumWorkingSetSize, dwMaximumWorkingSetSize: LongWord): LongBool; stdcall; external 'kernel32.dll';
    function GetCurrentProcess: LongWord; Stdcall; external 'kernel32.dll';
    procedure Sleep(dwMilliseconds: LongWord); stdcall; external 'kernel32.dll';

    begin
    MessageBoxA(0,'Hello from a small app.','Small App',0);
    SetProcessWorkingSetSize(GetCurrentProcess, $FFFFFFFF, $FFFFFFFF);
    MessageBoxA(0,'Hello from a smaller app.','Small App',0);
    SetProcessWorkingSetSize(GetCurrentProcess, $FFFFFFFF, $FFFFFFFF);
    Sleep(30000);
    end.


    Neat huh ? =)

    Don't know exactly why it shrinks the memory footprint....i assume it swaps unused data to disk or something but atleast it appears that the application uses a minimal amount of memory.


    [EDIT]
    Oh, and btw when needing a small application you should look into KOL
    http://bonanzas.rinet.ru/
    [/EDIT]

    Regards
    //raidos

  9. #19

    About memory usage...

    From the help at MSDN:

    If both dwMinimumWorkingSetSize and dwMaximumWorkingSetSize have the value -1, the function temporarily trims the working set of the specified process to zero. This essentially swaps the process out of physical RAM memory.
    $FFFFFFFF = -1 (take 1, negate all bits, add one ). A handy thing to know if a parameter is expected to be unsigned and you have to pass in -1...
    "All paid jobs absorb and degrade the mind."
    <br />-- Aristotle

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •