Memory, Processes and Threads

 

 

 

- RELEASE MEMORY, release unused memory (leak memory), use for example:

- ON KEY F5 ACTION ( RELEASE MEMORY )

- DEFINE TIMER ... ACTION ( RELEASE MEMORY )

 

- GetCurrentProcessID() --> return nProcessID

 

- EnumProcessID () ---> return array { nProcessID1, nProcessID2, ... }

 

- GetWindowThreadProcessID ( hWnd, @nThread, @nProcessID )

     

- IsWow64Process ( [ nProcessID ] ) --> return lBoolean

- return TRUE  if a 32-bit application is running under 64-bit Windows (WOW64)

- return FALSE if a 32-bit application is running under 32-bit Windows

- return FALSE if a 64-bit application is running under 64-bit Windows

Note: WOW64 (Win32 On Win64) is the x86 emulator that allows 32-bit Windows-based applications to running on 64-bit Windows

 

- GetProcessName ( [ nProcessID ] ) --> return cProcessName

 

- GetProcessFullName ( [ nProcessID ] ) --> return cProcessFullName

 

- GetProcessImageFileName ( [ nProcessID ] ) --> return cProcessImageFileName

 

- TerminateProcess ( [ nProcessID ] , [ nExitCode ] )

     

- EmptyWorkingSet( [ ProcessID ] ) ---> lBoolean

- release unused memory (leak memory)

 

 

- GetProcessMemoryInfo ( [ ProcessID ] ) --> returns an array with 9 numbers with used memory info for a process

PageFaultCount,              // The number of page faults

PeakWorkingSetSize,

WorkingSetSize,              // The current working set size, in bytes

QuotaPeakPagedPoolUsage,

QuotaPagedPoolUsage,         // The current paged pool usage, in bytes

QuotaPeakNonPagedPoolUsage,

QuotaNonPagedPoolUsage,      // The current nonpaged pool usage, in bytes

PagefileUsage,    // Total amount of memory that the memory manager has committed for the running this process, in bytes

PeakPagefileUsage

 

 

- GlobalMemoryStatusEx () --> returns an array with 7 numbers with used memory info for the system

MemoryLoad, // approximate percentage of physical memory that is in use (0 indicates no memory use and 100 indicates full memory use)

TotalPhys, // amount of actual physical memory, in bytes

AvailPhys, // amount of physical memory currently available, in bytes

TotalPageFile, // current committed memory limit for the system or the current process, whichever is smaller, in bytes

AvailPageFile, // maximum amount of memory the current process can commit, in bytes

TotalVirtual, // size of the user-mode portion of the virtual address space of the calling process, in bytes

AvailVirtual, // amount of unreserved and uncommitted memory currently in the user-mode portion of the virtual address space of the calling process, in bytes        

 

 

- HMG_GetObjectCount( [ nProcessId ] ) --> returns an array of 3 items with information about the number of system objects used for a process { nGDIObjects, nUserObjects, nKernelObjects }

 

GDI Objects: https://msdn.microsoft.com/en-us/library/ms724291(v=vs.85).aspx

            Bitmap

            Brush

            DC

            Enhanced metafile

            Enhanced-metafile DC

            Font

            Memory DC

            Metafile

            Metafile DC

            Palette

            Pen and extended pen

            Region

  

User Objects: https://msdn.microsoft.com/en-us/library/ms725486(v=vs.85).aspx

            Accelerator table

            Caret

            Cursor

            DDE conversation

            Hook

            Icon

            Menu

            Window

            Window position

 

Kernel Objects: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724485(v=vs.85).aspx

            Access token

            Change notification

            Communications device

            Console input

            Console screen buffer

            Desktop

            Event

            Event log

            File

            File mapping

            Find file

            Heap

            I/O completion port

            Job

            Mailslot

            Memory resource notification

            Module

            Mutex

            Pipe

            Process

            Semaphore

            Socket

            Thread

            Timer

            Update resource

            Window station

 

 

NOTE about 32/64 bit processes, in conventional way:

     - with apps of 32-bit is possible only get information about of 32-bit processes

- with apps of 32-bit is not possible get information about of 64-bit processes

- with apps of 64-bit is possible get information about of 32 and 64-bit processes