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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Virtual memory

Virtual memory

Scheduled Pinned Locked Moved C / C++ / MFC
performancetutorial
2 Posts 2 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.
  • J Offline
    J Offline
    jinijinu
    wrote on last edited by
    #1

    How to determine actual memory used for a process

    R 1 Reply Last reply
    0
    • J jinijinu

      How to determine actual memory used for a process

      R Offline
      R Offline
      Rane
      wrote on last edited by
      #2

      Use OpenProcess() to get a handle to the process that you want to monitor.Then use CreateToolhelp32Snapshot() API which will give you lists of the modules (DLLs) that are a part of your process image which you can then iterate using Module32First/Module32Next() and obtain the load addresses and extents. It will also give you a list of the heaps, runtime allocated memory used by alloc/free and stacks. You then use Heap32ListFirst/Heap32ListNext to iterate those and obtain their start addresses and extents. You then use those addresses with ReadProcessMemory() to actually read the Random Access Memory. Also, be sure to suspend the target process otherwise things could change the moment after you obtain your information. Regards, Rane

      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