Results 1 to 6 of 6

Thread: [2005] Memory use and windowstate

  1. #1

    Thread Starter
    Fanatic Member Crash893's Avatar
    Join Date
    Dec 2005
    Posts
    930

    [2005] Memory use and windowstate

    Hey all.

    I have a program that when i start it up minimized it uses 8,500k of memory

    then if i change the state to normal to jumps up to 9,000k but then if i mimize it again i goes down to 1200k of memory.

    My question is what is the difference between starting it up minimized and manually troggleing it and how can i emulate that progrmaicly so that hte program only eats up 1 or 2 k of memory.

  2. #2
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: [2005] Memory use and windowstate

    if you try to limit the amount of memory your application consumes, youre going to come up against nothing but problems. your application is going to take as much memory as it needs to.

  3. #3

    Thread Starter
    Fanatic Member Crash893's Avatar
    Join Date
    Dec 2005
    Posts
    930

    Re: [2005] Memory use and windowstate

    That didn't answer the question

  4. #4
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148

    Re: [2005] Memory use and windowstate

    The .NET framework preallocates huge lumps of memory at a time from the operating system and then manages that memory internally.

    You are looking at memory usage from the OS side which gives a false reading.

    The apparent memory usage goes down when an application is minimized because the .NET memory manager figures the app isn't likely to use that much memory if it isn't active.

    There are many better explanations on this site than what I've put above, so have a quick search - and don't worry it is perfectly normal.

  5. #5

    Thread Starter
    Fanatic Member Crash893's Avatar
    Join Date
    Dec 2005
    Posts
    930

    Re: [2005] Memory use and windowstate

    The reason im sweating this is becuase its going on a terminal server that will have 100 or so users on it.

    you can see why 9000k vs 1000k is a big diffrence to internal memory.

    the solution i have so far is

    (yes this is c#)
    c# Code:
    1. this.WindowState = FormWindowState.Minimized;
    2.             this.WindowState = FormWindowState.Normal;
    3.             this.WindowState = FormWindowState.Minimized;
    I just can't believe that this is the best way to do things

  6. #6
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: [2005] Memory use and windowstate

    I have seen questions about this for at least the last four years, and have never seen an answer that was fundamentally different from what BrailleSchool posted, as unfortunate as that may seem to you. The problem, if you can call it that, is that memory management is out of your hands. The OS giveth and the OS taketh away. The actual memory being used by your program is probably quite a bit smaller than either number, and the OS will reclaim the unused portion as it needs to. Therefore, no matter how you shake and dance, the true usage by your app is probably not something you can materially affect.
    My usual boring signature: Nothing

Posting Permissions

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



Click Here to Expand Forum to Full Width