Jump to content

How much memory a process has?


EWOlson
 Share

Recommended Posts

OK, I've written, or rewritten, a script that changes the values of the Space Cadet pinball game that comes with the more recent versions of Windows. Now I want to search memory in other processes and I want to know how to tell how much memory the process uses so I don't do any more searching than I need to. How do I do that? I'll be using the same memory functions I used in the Space Cadet trainer. It is located in "v3 Scripts and Scraps" under "Pinball Trainer" if someone would like to take a look. I got the functions from Dellairion, but I don't know if they are his or someone else's.

Thanks.

Link to comment
Share on other sites

Windows applications running on 32-bit versions of the OS have a 2GB virtual address space.

Is there any way to find out how much of that 2GB the process is actually using? Would GetProcessWorkingSetSize do me any good? Do you have any additional information on the virtual address space?

Link to comment
Share on other sites

Memory is allocated non-contiguously. I'm sure there are tricks that can be used such as checking pages to see if they are committed to optimize a search. However, it's not the most simple thing to do nor will it be very fast to do it in AutoIt. Something like this needs done in a lower level language than AutoIt; something that allows more direct access to memory. While it's possible to do with AutoIt, there are a lot of extra layers involved that dramatically slow the process down.

I'd recommend sticking with a tool like TSearch for this sort of thing. TSearch is fast and works well at what it does. AutoIt isn't really suited for this task.

Link to comment
Share on other sites

@EWOlson/Valik

Why run an exteral appl. while windows has it all.

Run TASKLIST in the CMD and there it is.

This is some code I started but never finished.

May you can :

#include <Constants.au3>

Dim $gui_width = 500
Dim $gui_height = 600

GUICreate("Task Process DLL Info V 1.0", $gui_width, $gui_height, @Desktopwidth/2 - $gui_width/2, @DesktopHeight/2 - $gui_height/2 - 75)
$listview = GUICtrlCreateList("", 10, 10, $gui_width - 20, $gui_height - 45)
$Btn1 = GUICtrlCreateButton("Read Info",10,$gui_height - 30,80,20)
$Btn2 = GUICtrlCreateButton("Print",100,$gui_height - 30,50,20)

GUISetState ()

While 1
     $msg = GUIGetMsg()
    ; If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    Select
        Case $msg = $Btn1
          ReadInfo()
        Case $msg = $Btn2
          ;Print()
    EndSelect    
Wend


;ReadInfo()
Func ReadInfo()
    
$Parameter = "/M"
$Output_CSV = "/FO Table" 
$Header_NO= "/NH"
$Info = Run('taskList.exe '&$Header_NO, "", @SW_HIDE,$STDERR_CHILD + $STDOUT_CHILD)
    
While 1
    
    $line = StdoutRead($Info)
    If @error Then ExitLoop
    ConsoleWrite($Line)
    
    $temp = GUICtrlSetData($listview,$line&@lf) 
Wend

While 1
    $line = StderrRead($Info)
    If @error Then ExitLoop
    ConsoleWrite( "STDERR read: "& $line& @CR)
Wend
EndFunc

Enjoy !!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...