Re: why does minimizing my app cut mem usage by 90%?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Alexander Grigoriev (alegr_at_earthlink.net)
Date: 06/28/04


Date: Sun, 27 Jun 2004 17:39:02 -0700

Trimming working set could make sense with smaller RAM sizes, but not
anymore. It makes Windows paging even more sluggish. I could never
understand why a XP system with 1 GB of RAM has to page the applications
back in after user session switch. Apparently, switch to another user
session minimizes all the applications in the first session (they will get
restored in wrong Z-order, too). Their working set gets trimmed. But why a
free page request gets satisfied from those "candidate" pages, not from
really free memory, which is plenty? Why file cache may get bloated without
a limit, by expense of application memory, starving the applications? MS
programmers don't seem to get a second thought about their paging system
performance. It's sad.

"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:4f9ud0heucoud9859sjkdpgpvflnqncdvo@4ax.com...
> I'd not seen that article; thanks for pointing it out. But it just proves
my continuing
> assertion that the values returned by task manager for program size are
essentially
> meaningless, and cannot be trusted.
>
> It is worth pointing out that "minimizing" an app as he desires to do
actually doesn't
> minimize its memory footprint; it merely pessimizes its performance,
because those pages
> have to be paged back in anyway. The OS is quite capable of removing the
pages itself if
> they haven't been used in a while, so why waste any effort?
>
> Or, this shows that people always want to optimize the wrong thing.
Creating a minimum
> memory footprint at the expense of significantly increased paging effort
is certainly a
> very losing idea. A page fault costs approximately six orders of magnitude
performance
> penalty on an access over accessing the value in memory.
>
> Bottom line: don't waste time solving problems that don't exist, while
creating whole new
> problems you are not aware of.
> joe
>
> On Thu, 24 Jun 2004 21:35:50 -0700, "Alexander Grigoriev"
<alegr@earthlink.net> wrote:
>
> >http://support.microsoft.com/default.aspx?scid=kb;en-us;Q293215
> >
> >"Nobody" <nobody@cox.net> wrote in message
> >news:gQNCc.1014$_I3.412@lakeread03...
> >> I have an MFC application that upon startup uses about 20MB of memory
> >> according to task manager. I noticed that if I minimize the app, memory
> >goes
> >> down to about 1MB to 2MB and never returns to 20MB even if I restore
the
> >> app.
> >>
> >> I noticed every other app does this as well. VStudio from 50MB to about
> >3MB,
> >> Outlook from 57MB to 5MB, etc.
> >>
> >> Seems like some garbage collection is getting called or something?
> >>
> >> How can I trigger this behavior without programatically minimizing my
app
> >> which looks ugly on the screen.
> >>
> >>
> >
>
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm



Relevant Pages

  • Re: Lock memory ?
    ... paging kernel. ... the working set model is ... >> There is far less memory than hard disk space. ... >> You can write a device driver that does it. ...
    (microsoft.public.vc.mfc)
  • Re: Memory manager writing pages back to executables...
    ... those addresses into the kernel-mode area of the memory. ... No, images are mapped copy on write, the pages would be eligible for paging ... true for the mapped page writter, ... the same rules as other working set pages. ...
    (microsoft.public.development.device.drivers)
  • Re: How to set up a Linux machine that occupies the minimum memory footprint ?
    ... >>memory and hence causes the kernel to 'thrash' thus slowing down the ... GBytes of RAM, but in fact it will get at most 4, and the rest will be ... Now if the working set at any time is smaller than 4 GB, ... OK, but otherwise, the paging will probably kill you in terms of performance. ...
    (comp.os.linux.misc)
  • Re: How to set up a Linux machine that occupies the minimum memory footprint ?
    ... >>memory and hence causes the kernel to 'thrash' thus slowing down the ... GBytes of RAM, but in fact it will get at most 4, and the rest will be ... Now if the working set at any time is smaller than 4 GB, ... OK, but otherwise, the paging will probably kill you in terms of performance. ...
    (comp.os.linux.setup)
  • Re: Can extra processing threads help in this case?
    ... believe that paging is an essential part of the virtual ... with virtual memory WITHOUT paging being a part of it, ... VM, even with paging, does not imply that the realtime ... It says RT requires determinism. ...
    (microsoft.public.vc.mfc)