News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Get Memory size

Started by ragdog, March 27, 2010, 07:39:18 AM

Previous topic - Next topic

ragdog

Hello

Can i calculate the memory size of a running process

I get The baseaddr and Basesize with Module32First


   mov  ecx,hModule.modBaseAddr  ;00400000
    add  ecx,hModule.modBaseSize   ;14000
    mov [hEndOfMem],ecx              ;result  00414000

my result is 7362A265 why this?

greets

hutch--

Vaguely I remember this being a characteristic of the PE header and I gather here you are talking about the range from the start address 400000h to the end of the loaded executable module. For a DLL you will need to get the start address with GetModuleHandle().
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Slugsnack

show all your code. it's not making sense

donkey

If you're already enumerating the process why not use GetProcessMemoryInfo ?

http://msdn.microsoft.com/en-us/library/ms683219%28VS.85%29.aspx

Also are you talking about physical or total memory, working set or actual usage, average minimum or peak usage ? Are you looking for the usage of just the main module or all modules in the process, do you want to know the heap and stack allocations as well ? When it comes to memory in Windows (or any modern OS) you have to specify exactly what usage statistic you are looking for.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable