Hi All,
Is there any API which can give virtual memory usage of all the
applications on Windows CE ?
Our problem is sometime system reboots logging message in eventlog "not
enough memeory".
We have build a small tool using ToolHelp which gives physical memory
usage. I did not find anything in ToolHelp which can help me to get Virtual
Memory usage for each application.
Regards,
Rajiv

Re: virtual memory usage tracking by rajiv

rajiv
Tue Oct 21 12:12:29 CDT 2003

Hi All,
This is very important for me. I will appreciate any kind of
feedback/suggestions on this.
Regards,
Rajiv.
"rajiv" <rsingh@mobilearia.com> wrote in message
news:ub66T80lDHA.3312@tk2msftngp13.phx.gbl...
> Hi All,
> Is there any API which can give virtual memory usage of all the
> applications on Windows CE ?
> Our problem is sometime system reboots logging message in eventlog "not
> enough memeory".
> We have build a small tool using ToolHelp which gives physical memory
> usage. I did not find anything in ToolHelp which can help me to get
Virtual
> Memory usage for each application.
> Regards,
> Rajiv
>
>



Re: virtual memory usage tracking by Graeme

Graeme
Wed Oct 22 04:57:17 CDT 2003

To get the memory stats for a device try using :

GlobalMemoryStatus

Cheers
--
-Graeme Wintle (eMVP)


"rajiv" <rsingh@mobilearia.com> wrote in message
news:%23AcbFa$lDHA.2488@TK2MSFTNGP12.phx.gbl...
> Hi All,
> This is very important for me. I will appreciate any kind of
> feedback/suggestions on this.
> Regards,
> Rajiv.
> "rajiv" <rsingh@mobilearia.com> wrote in message
> news:ub66T80lDHA.3312@tk2msftngp13.phx.gbl...
> > Hi All,
> > Is there any API which can give virtual memory usage of all the
> > applications on Windows CE ?
> > Our problem is sometime system reboots logging message in eventlog
"not
> > enough memeory".
> > We have build a small tool using ToolHelp which gives physical memory
> > usage. I did not find anything in ToolHelp which can help me to get
> Virtual
> > Memory usage for each application.
> > Regards,
> > Rajiv
> >
> >
>
>



Re: virtual memory usage tracking by rajiv

rajiv
Wed Oct 22 13:34:38 CDT 2003

Hi Graeme,
It gives me virtual memory usage only for the calling process.
My goal is to get it for each process from outside ( like heap traversal
using ToolHelp).
The reason I needs this, take an e.g. where an application calls
VirtualAlloc and forgets VirtualFree.This will lead to no memory for an app
even though there is plently of free physical memory.
I am particularly looking into Device.exe where the DLLs are from different
vendors.
Regards,
Rajiv
"Graeme Wintle (eMVP)" <graemew@intrinsyc.com> wrote in message
news:eGKQkLImDHA.2820@TK2MSFTNGP10.phx.gbl...
> To get the memory stats for a device try using :
>
> GlobalMemoryStatus
>
> Cheers
> --
> -Graeme Wintle (eMVP)
>
>
> "rajiv" <rsingh@mobilearia.com> wrote in message
> news:%23AcbFa$lDHA.2488@TK2MSFTNGP12.phx.gbl...
> > Hi All,
> > This is very important for me. I will appreciate any kind of
> > feedback/suggestions on this.
> > Regards,
> > Rajiv.
> > "rajiv" <rsingh@mobilearia.com> wrote in message
> > news:ub66T80lDHA.3312@tk2msftngp13.phx.gbl...
> > > Hi All,
> > > Is there any API which can give virtual memory usage of all the
> > > applications on Windows CE ?
> > > Our problem is sometime system reboots logging message in eventlog
> "not
> > > enough memeory".
> > > We have build a small tool using ToolHelp which gives physical
memory
> > > usage. I did not find anything in ToolHelp which can help me to get
> > Virtual
> > > Memory usage for each application.
> > > Regards,
> > > Rajiv
> > >
> > >
> >
> >
>
>



Re: virtual memory usage tracking by sloh

sloh
Thu Oct 23 09:57:44 CDT 2003

You can use VirtualQuery to query the VM usage within each 32MB process
slot. It's not going to give you simple numbers for each process, you'll
have to iterate over all of the memory and add up totals yourself, but it
will get the job done. If the problem is running out of virtual address
space then that should help you figure it out.

Sue
sloh@microsoft.com (remove "online" from reply-to address)
_____________________________________________________________
This posting is provided "AS IS" with no warranties, and confers no rights.
_____________________________________________________________
Windows Embedded FAQ
(http://www.microsoft.com/windows/embedded/faq/default.asp)


Re: virtual memory usage tracking by rajiv

rajiv
Wed Oct 29 18:10:43 CST 2003

Hi sloh,
Thanks a lot for reply. I looked at this API. The
official documents mentions that it will work only for
calling process. From MSDN :
"This function provides information about a range of
pages in the virtual address space of the calling process."

Do you mean that it will still work for any base address
like I start from 0x00000000 and go on ?
The other problem is I need to know the owner process
causing virtual memory leak. I did not find a way by which
I can do that. The functionality which I really want
is "VirtualQueryEx". Any other ideas to accomplish the
task ?


Regards,
Rajiv
>-----Original Message-----
>You can use VirtualQuery to query the VM usage within
each 32MB process
>slot. It's not going to give you simple numbers for each
process, you'll
>have to iterate over all of the memory and add up totals
yourself, but it
>will get the job done. If the problem is running out of
virtual address
>space then that should help you figure it out.
>
>Sue
>sloh@microsoft.com (remove "online" from reply-to
address)
>__________________________________________________________
___
>This posting is provided "AS IS" with no warranties, and
confers no rights.
>__________________________________________________________
___
>Windows Embedded FAQ
>
(http://www.microsoft.com/windows/embedded/faq/default.asp)
>
>.
>

Re: virtual memory usage tracking by sloh

sloh
Thu Oct 30 15:35:48 CST 2003

You can also try doing "mi full" in the target command window.

CE doesn't have VirtualQueryEx but you don't need it. You can use
VirtualQuery for everything. CE's VM ranges are pretty static. Each
process gets a 32MB "slot" of memory, so the lowest GB+ of RAM is divided
into 33 "slots", 2 special ones and 31 for processes:

0x00000000-0x01FFFFFF is slot 0 (always mapped to current running process)
0x02000000-0x03FFFFFF is slot 1 (ROM DLL code)
0x04000000-0x05FFFFFF is slot 2 (first process -- always filesys.exe)
.. plus 30 more slots for the other processes. The kernel (nk.exe) is the
32nd process and doesn't use these slots.

Beyond that you get the object store and shared VM, used for large
VirtualAllocs and memory-mapped files, up to 0x7FFFFFFF. If one of your
processes is leaking shared memory then there's no easy way to find out
what process is doing it. There is an article on the web about CE's
virtual memory layout that I often see our eMVP's post on the newsgroups.
I don't currently have a link to it but I think you should be able to find
it by searching. Often a VM "leak" is really an overlap between VM
used/needed by DLLs, and other memory within a process. If you think you
are having VM problems then you should try to read that article.

Sue
sloh@microsoft.com (remove "online" from reply-to address)
_____________________________________________________________
This posting is provided "AS IS" with no warranties, and confers no rights.
_____________________________________________________________
Windows Embedded FAQ
(http://www.microsoft.com/windows/embedded/faq/default.asp)