Re: GetTotalMemory, GlobalMemoryStatus

From: Chris Tacke, eMVP (ctacke_at_spamfree-opennetcf.org)
Date: 05/11/04


Date: Tue, 11 May 2004 16:06:09 -0400

Even a simple managed app must launch the EE and load many of the CF base
class libraries, so 1MB is no surprise to me. Since they're in the GAC,
launching a *second* simple app will probably only use about another 8k.

-- 
Chris Tacke, eMVP
Co-Founder and Advisory Board Member
www.OpenNETCF.org
---
Windows CE Product Manager
Applied Data Systems
www.applieddata.net
"Daniel Moth" <dmoth74@hotmail.com> wrote in message
news:%23t$EaX4NEHA.2716@tk2msftngp13.phx.gbl...
> OK, sorry, when I said "no other apps" I meant no apps of mine (thought
the
> "taking in account memory used by the system" bit covered that)...
>
> In any case, if we open explorer pointing to the folder where the exe
> resides and then check the memory in use (from the memory panel) we get a
> value A. If we then launch our exe and go back to the panel we see a value
> B. If C=B-A, isn't it fair to say that C is the amount of bytes used by
our
> app/process?
>
> If not then please let me know what I am missing?
>
> If it is, then (some of) my original questions were:
> 1) Why is C=9072KB when GetTotalMemory(false) returns 446KB
> 2) How come the simplest CF app (8KB exe) shows C=over 1MB
> 3) After a GC.Collect, GetTotalMemory diminishes but C remains constant.
> Why?
>
> Cheers
> Daniel
>
> PS
> I am not positive I know what you mean by this:
>
> >>As I recall, the RAM filesystem is allocated by the file system
> >> manager.  It's possible that the memory that you have allocated to that
> >> is
> >> contributing a significant fraction of what you are seeing allocated.
>
> If you mean the size of my binaries they are 1MB in total so a long way to
> almost 9MB isn't it?
>
>
>
> "Paul G. Tobey [eMVP]" <ptobey_no_spam@instrument_no_spam.com> wrote in
> message news:%23Vh$aq3NEHA.680@TK2MSFTNGP11.phx.gbl...
> > There are *always* several applications running and they use a fair
amount
> > of memory.  The kernel (nk.exe), the windowing system (gwes.exe), the
> device
> > manager (device.exe), the file system manager (filesys.exe), etc. are
all
> in
> > there.  As I recall, the RAM filesystem is allocated by the file system
> > manager.  It's possible that the memory that you have allocated to that
is
> > contributing a significant fraction of what you are seeing allocated.
> >
> > Paul T.
> >
> > "Daniel Moth" <dmoth74@hotmail.com> wrote in message
> > news:OGAvQb3NEHA.3420@TK2MSFTNGP11.phx.gbl...
> > > Hi
> > >
> > > Hopefully someone can help me clarify some memory issues and in
> particular
> > > the difference between GetTotalMemory & GlobalMemoryStatus...
> > >
> > > Apparently GetTotalMemory(false) retrieves the number of bytes
currently
> > > thought to be allocated. I assume the bytes returned reflect only the
> > > managed bytes(objects) that *my* managed code has allocated, is that
> > > correct? In other words if I have PInvoke calls that allocate memory
> that
> > > would not be included, right? Is there anything else GetTotalMemory
> > excludes
> > > that one would assume is included?
> > >
> > > I observe a large difference between what GetTotalMemory returns and
> what
> > > GlobalMemoryStatus reports (taking in account the memory used by the
> > system.
> > > No other apps running). I am guessing this is because the
> > GlobalMemoryStatus
> > > includes the JITed code as used memory whereas GetTotalMemory doesn't;
> is
> > > that correct? Still the discrepancy is large so there must be other
> > factors
> > > that I am not aware of... For example when GetTotalMemory returns
446KB
> > > GlobalMemoryStatus (or indeed the memory control panel or even the
> remote
> > > system info from eVC) shows 9072KB. What extra bytes is it including?
> > >
> > > It seems even the simplest CF app (8KB exe) consumes over 1MB of
memory.
> > Is
> > > that right or is there some flaw in my approach? Also GC.Collect
affect
> > the
> > > results of GetTotalMemory but not the results of GlobalMemoryStatus...
> is
> > > that in line with your observations?
> > >
> > > Note that when the above results are observed, I then leave the
unit/app
> > > running for at least 1 hour (in idle mode) and the results remain the
> > > same... I have also used the slider to effectively force a memory load
> of
> > > over 95%...
> > >
> > > Cheers
> > > Daniel
> > >
> > >
> > >
> > >
> >
> >
>
>
>


Relevant Pages

  • Re: Memory Management
    ... include the memory manager after any files that declare malloc etc. I'm not ... I have tried to export the operators from a DLL, ... I'm still using the CRT's malloc and free to allocate memory. ...
    (microsoft.public.vc.language)
  • Re: Multithreading the IDE?
    ... > will get a lot of attention for the next Delphi release - and it will ... > of consuming significantly more memory than the more efficient single ... > threaded heap manager. ... > performance for a few Delphi apps. ...
    (borland.public.delphi.non-technical)
  • Re: Latency data - 2.6.14-rc3-rt13
    ... I guess my apps don't allocate enough memory to ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: GetTotalMemory, GlobalMemoryStatus
    ... OK, sorry, when I said "no other apps" I meant no apps of mine (thought the ... "taking in account memory used by the system" bit covered that)... ... GetTotalMemory diminishes but C remains constant. ... In other words if I have PInvoke calls that allocate memory ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Executing query eats up memory ?
    ... You can use Task Manager on the server to view the amount of memory the ... VB apps take during execution. ...
    (microsoft.public.sqlserver.programming)