Memory problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jakub Cermak

    Memory problem

    Hello,
    I've problem with amount of allocated memory.
    System.GC.GetTo talMemory(false ) returns, that I have allocated about
    5MB, but task manager says that my process is consuming more than 60MB -
    how is this possible? How to reduce consumed memory?
    --
    Best regards,

    Jakub Cermak
    ICQ 159971304

  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Memory problem

    Jakub,

    Task manager is showing you the working set, not the memory allocated.

    If you want a number to compare the call of GetTotalMemory against,
    check out the performance counters for .NET. They will give you the
    information you are looking for.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "Jakub Cermak" <ja.cermi@centr um.czwrote in message
    news:%230pLKSe0 GHA.4476@TK2MSF TNGP05.phx.gbl. ..
    Hello,
    I've problem with amount of allocated memory.
    System.GC.GetTo talMemory(false ) returns, that I have allocated about 5MB,
    but task manager says that my process is consuming more than 60MB - how is
    this possible? How to reduce consumed memory?
    --
    Best regards,
    >
    Jakub Cermak
    ICQ 159971304
    http://cermi.wz.cz

    Comment

    • Jakub Cermak

      #3
      Re: Memory problem

      Nicholas Paldino [.NET/C# MVP] wrote:
      Jakub,
      >
      Task manager is showing you the working set, not the memory allocated.
      >
      If you want a number to compare the call of GetTotalMemory against,
      check out the performance counters for .NET. They will give you the
      information you are looking for.
      >
      Hope this helps.
      >
      >
      No, it didn't. I don't need to determine how much memory I'm using, I
      need to lower total allocated memory in taskmanager. Because there is
      quite big difference between 60-100MB and 5MB. It is server application,
      and I need to use as less memory as possible .... there is no much RAM :(

      --
      Best regards,

      Jakub Cermak
      ICQ 159971304

      Comment

      • Chris Dunaway

        #4
        Re: Memory problem

        Jakub Cermak wrote:
        Nicholas Paldino [.NET/C# MVP] wrote:
        Jakub,

        Task manager is showing you the working set, not the memory allocated.

        If you want a number to compare the call of GetTotalMemory against,
        check out the performance counters for .NET. They will give you the
        information you are looking for.

        Hope this helps.
        >
        No, it didn't. I don't need to determine how much memory I'm using, I
        need to lower total allocated memory in taskmanager. Because there is
        quite big difference between 60-100MB and 5MB. It is server application,
        and I need to use as less memory as possible .... there is no much RAM :(
        >
        You're missing the point. TaskManager is *WRONG*. It does not
        accurately reflect the amount of memory your app is using. Check out
        this article:



        Comment

        • Willy Denoyette [MVP]

          #5
          Re: Memory problem


          "Jakub Cermak" <ja.cermi@centr um.czwrote in message
          news:%230pLKSe0 GHA.4476@TK2MSF TNGP05.phx.gbl. ..
          | Hello,
          | I've problem with amount of allocated memory.
          | System.GC.GetTo talMemory(false ) returns, that I have allocated about
          | 5MB, but task manager says that my process is consuming more than 60MB -
          | how is this possible? How to reduce consumed memory?
          | --
          | Best regards,
          |
          | Jakub Cermak
          | ICQ 159971304
          | http://cermi.wz.cz

          System.GC.GetTo talMemory returns the amount of managed memory, that is the
          amount of memory allocated from the GC collected heap. Taskman shows you the
          Working Set (Mem Usage) and the Virtual bytes used by the process.
          5MB of managed memory and a Working set of 60MB is in general an indication
          that you (directly or indirectly) are allocating unmanaged memory, which you
          you fail to release. Now the question is what kind of application is this
          and what exactly are you loking at in taskman (Mem usage or VM Size)


          Willy.


          Comment

          • Jakub Cermak

            #6
            Re: Memory problem

            Willy Denoyette [MVP] wrote:
            System.GC.GetTo talMemory returns the amount of managed memory, that is the
            amount of memory allocated from the GC collected heap. Taskman shows you the
            Working Set (Mem Usage) and the Virtual bytes used by the process.
            5MB of managed memory and a Working set of 60MB is in general an indication
            that you (directly or indirectly) are allocating unmanaged memory, which you
            you fail to release.
            I'm not using unmanaged memory directly and I use just MySQL connection
            libraries and standard system libraies
            (System.Xml,Sys tem.ServiceProc ess,System.Data ,System.Runtime Remoting).
            Can it be reason?


            Now the question is what kind of application is this
            and what exactly are you loking at in taskman (Mem usage or VM Size)
            >
            >
            I mean VM Size + Mem usage together
            Willy.
            >
            >

            --
            Best regards,

            Jakub Cermak
            ICQ 159971304

            Comment

            • Arne Vajhøj

              #7
              Re: Memory problem

              Jakub Cermak wrote:
              I've problem with amount of allocated memory.
              System.GC.GetTo talMemory(false ) returns, that I have allocated about
              5MB, but task manager says that my process is consuming more than 60MB -
              how is this possible? How to reduce consumed memory?
              Those numbers are very difficult to compare.

              GC.GetTotalMemo ry returns the memory your application
              has allocated from the .NET runtime.

              The task manager displays working set. Even if we ignore
              the difference between working set and memory, then
              this includes:
              * the memory .NET has allocated from Windows for heap usage
              (which may be different from what your app has allocated from .NET)
              * memory used by .NET runtime itself and various unmanaged
              ressources

              60 MB sounds a little high, but it is actually not much memory
              theese days.

              Arne

              Comment

              • Willy Denoyette [MVP]

                #8
                Re: Memory problem


                "Jakub Cermak" <ja.cermi@centr um.czwrote in message
                news:%23mrS6af0 GHA.328@TK2MSFT NGP06.phx.gbl.. .
                | Willy Denoyette [MVP] wrote:
                |
                | System.GC.GetTo talMemory returns the amount of managed memory, that is
                the
                | amount of memory allocated from the GC collected heap. Taskman shows you
                the
                | Working Set (Mem Usage) and the Virtual bytes used by the process.
                | 5MB of managed memory and a Working set of 60MB is in general an
                indication
                | that you (directly or indirectly) are allocating unmanaged memory, which
                you
                | you fail to release.
                |
                | I'm not using unmanaged memory directly and I use just MySQL connection
                | libraries and standard system libraies
                | (System.Xml,Sys tem.ServiceProc ess,System.Data ,System.Runtime Remoting).
                | Can it be reason?
                |
                I can't tell, you have to measure. Run your application and check the
                perfomance counters, or better run your application in a profiler.

                |
                | Now the question is what kind of application is this
                | and what exactly are you loking at in taskman (Mem usage or VM Size)
                | >
                | >
                | I mean VM Size + Mem usage together
                |

                You should NOT add these!


                Willy.


                Comment

                Working...