Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How much memory does a process have?

How much memory does a process have?

Scheduled Pinned Locked Moved C / C++ / MFC
questionjsonperformancehelptutorial
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    What is the series of Win32 API calls to determine how much memory a process is holding on to? For example, this set of API calls should give a bigger number each time I call malloc(), etc. Thanks for your help:confused:

    S M 2 Replies Last reply
    0
    • L Lost User

      What is the series of Win32 API calls to determine how much memory a process is holding on to? For example, this set of API calls should give a bigger number each time I call malloc(), etc. Thanks for your help:confused:

      S Offline
      S Offline
      Stephane Rodriguez
      wrote on last edited by
      #2

      2GB per process. (4GB addressable, 2GB for kernel, 2GB for user). Add /3GB in boot.ini to get 3GB for user, 1GB for kernel.


      And I swallow a small raisin.

      1 Reply Last reply
      0
      • L Lost User

        What is the series of Win32 API calls to determine how much memory a process is holding on to? For example, this set of API calls should give a bigger number each time I call malloc(), etc. Thanks for your help:confused:

        M Offline
        M Offline
        Mike Nordell
        wrote on last edited by
        #3

        GetProcessHeaps + HeapWalk can be of use, but maybe a simple GetProcessWorkingSetSize wold do in this case.

        S 1 Reply Last reply
        0
        • M Mike Nordell

          GetProcessHeaps + HeapWalk can be of use, but maybe a simple GetProcessWorkingSetSize wold do in this case.

          S Offline
          S Offline
          sysop HAL9K com
          wrote on last edited by
          #4

          No, it doesn't work, at least according to the way I've tried to use it. The following code always returns the same values (workingset size never changes):

          #include void main()
          {
          long minn, maxx;
          long nbytes=1;
          while (1) {
          GetProcessWorkingSetSize(GetCurrentProcess(), &minn, &maxx);
          printf("%ld %ld\n", minn, maxx);
          malloc(nbytes);
          nbytes *= 2;
          Sleep(1000);
          }
          }

          #include C:\temp>workingset
          204800 1413120
          204800 1413120
          204800 1413120
          204800 1413120
          204800 1413120
          204800 1413120
          204800 1413120
          204800 1413120
          204800 1413120
          204800 1413120
          204800 1413120
          204800 1413120
          204800 1413120
          204800 1413120
          204800 1413120
          204800 1413120
          204800 1413120
          204800 1413120
          204800 1413120
          204800 1413120
          204800 1413120
          204800 1413120

          :omg:

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups