physical memory based

Posted on 2006-04-30
Last Modified: 2010-04-17
how can i know which running process holds how much physical memory
right can i write the code which will detect the memory usage
of a running process.please help me.

thanks in advance
Question by:davinder101
    LVL 3

    Accepted Solution

    i think you'll be looking at Jconsole for this:

    It's not something i've ever attempted so i'm not sure of how feasible it is, but Jconsole seems the trick (to begin with anyway).

    LVL 7

    Assisted Solution

    pview.exe (Part of platform SDK tools) will give you any breakdowns you require.  Programatically you can use C# and the System.Diagonistics package

    // Get all processes in 'proc' array
    Diagnostics::Process *p[]=Diagnostics::Process::GetProcesses();

    // Run through all processes
    for(int n=proc->GetLength(0),i=0; i < n; i++) {
      Console::Write(proc[i]->ProcessName);  Console::Write("\t");
        // Name of the process (no extension)
        // Number of threads
      Console::Write("\t");  Console::Write(proc[i]->HandleCount);
        // Number of handles

      /*System::TimeSpan ts=proc[i]->TotalProcessorTime;

        // Title of main window - null if no UI
    You will also want to look at ProcessThread and ProcessThreadCollection classes

    Each process can be explored via the /proc/ filesystem, including memory stats.
    [root@streams1 pam.d]# ls /proc/21284/ -l
    total 0
    -r--r--r--    1 root     root            0 May  1 12:42 cmdline
    lrwxrwxrwx    1 root     root            0 May  1 12:42 cwd -> /etc/pam.d
    -r--------    1 root     root            0 May  1 12:42 environ
    lrwxrwxrwx    1 root     root            0 May  1 12:42 exe -> /bin/bash
    dr-x------    2 root     root            0 May  1 12:42 fd
    -r--r-----    1 root     root            0 May  1 12:42 maps
    -rw-------    1 root     root            0 May  1 12:42 mem
    -r--r--r--    1 root     root            0 May  1 12:42 mounts
    lrwxrwxrwx    1 root     root            0 May  1 12:42 root -> /
    -r--r--r--    1 root     root            0 May  1 12:42 stat
    -r--r--r--    1 root     root            0 May  1 12:42 statm
    -r--r--r--    1 root     root            0 May  1 12:42 status


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    This article will show, step by step, how to integrate R code into a R Sweave document
    This is an explanation of a simple data model to help parse a JSON feed
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now