Life of a techno-guru
Wednesday, December 06, 2006
  Response to Digg Article Claiming to Free up Memory
So, a post on recently came up where someone claimed that running rundll32.exe advapi32.dll,ProcessIdleTasks would in reality "clear up your system memory" and make your system run faster as a result! Of course, no claim like this should be believed these days without some factual basis, so I decided to do a little bit of research since I have a relatively good understanding of Windows as an o/s, and a novice understanding of programming.

As it turns out, there truly is a function in advapi32.dll called ProcessIdleTasks; This can be found using a tool from Nirsoft called DllExport Viewer. What is not correct, however, is the general understanding of what this function does. Simply doing a Google search for this function's name yielded quite a few results including articles and forum postings in which people claimed that this function freed up memory in Windows. Another interesting search result came from Microsoft itself, in the form of an article about benchmarking. In this article, it clearly states the following:

"The file placement optimization, which is done no more often than once every three days, is an example of a task that is carried out when the system is deemed to be idle. System Restore and other features of Windows XP also attempt to defer some work until the system is deemed to be idle. There are also some done-once-after-setup work items that also operate under the Idle Task Scheduling mechanisms.

All of these "idle tasks" are controllable by a system API in advapi32.dll, ProcessIdleTasks. The APIs sole purpose is to allow benchmarks a simple way to force any pending idle tasks to be executed immediately, without having to wait a lengthy period of time."

That, to me, seems like it has absolutely nothing to do with "memory optimization." It would seem that this function simply puts Windows XP into an idle state, enabling it to perform tasks that it wouldn't normally do while the computer is in use. Anyway, I hope this clears up some misunderstandings regarding the usage of this function.
Actually what i heard is that "Some programs dont free the memory they hav been using even after the program has terminated. In this case, running the advapi32 ,processidletasks will force them to release the resources." Sounds possible to me !
Well, I'm open to suggestion, but from what you're saying, something doesn't seem right. If a process has terminated, then there is no way that calling ProcessIdleTasks will force it to do anything, because it doesn't exist.

Windows XP's memory management works just fine without any intervention.
Actually, forcing the processing of idle tasks does confer some performance benefit. I don't know if it frees up memory but it does usually run the following tasks: dfrgntfs.exe and defrag.exe. From what I understand, this is a "boot time defrag" (different from a regular degrag) which will speed up your Windows boot.
This comment has been removed by the author.
Well the best solution really is try it out and see how it works out. Honestly it seems to work. After playing heavy 3d games and burning dvds at the same while running office apps, the pc almost lags to a standstill. Doing ProcessIdleTasks instantly does the job of refreshing everything back like just after a fresh reboot.
The question here, seems to be where do "pending idle tasks" await execution? Memory, virtual memory, on disk until ProcessIdle... is run? I doubt on disk, like a run_once command, since it doesn't sound like that. My guess is that they sit in memory or virtual memory until the command is run, but they don't actually take up a whole lot of space. In the case where someone is gaming and burning, more idle tasks might build up to mean more noticeable difference upon execution of this command. While, other chatting, video-watching users might not see much difference.

I'd be interested in reading an official answer to this question. If I find one, I'll post. (No offense intended to Mr. Sullivan.)
This comment has been removed by the author.
What advapi32.dll,ProcessIdleTasks actually does is to carry out a similar task to that of a defragmentation program, except it does it in a specific way.

When you first install your OS (XP onward only - this was a feature introduced with the XP platform), the prefetch folder found in %windir%/prefetch is unpopulated. When you have installed all of your additional programs, a file pertaining to that program will be placed in the prefetch folder and will have the extension .PF (you can check this).

This will mean that the OS upon booting will know these programs are to be loaded as a priority. The best way of achieving system optimisation is after finalising your installation, reboot your computer 3 times to correctly populate the prefetch folder with all of your regularly ran startup programs.

Without doing this will mean that immediately after a new install your OS will not run at optimimum speed until the prefetch is completed, even then after 3 reboots it'll only be 90% optimised. If at this point you run the command rundll32.exe advapi32.dll,ProcessIdleTasks the referenced programs are moved to the outer edge of the Hard Drive meaning the OS can access them quicker and will complete the remaining 10% of your system optimisation.

Without running this command you would have to leave your system turned on and IDLE for 3 days to have the same effect. :P

My guess is that they sit in memory or virtual memory until the command is run, but they don't actually take up a whole lot of space.

advertising agencies
My guess is that they sit in memory or virtual memory until the command is run, but they don't actually take up a whole lot of space.

advertising agencies
Post a Comment

<< Home
My life of learning various things about technology including network administration, development, and 3D design

Location: Chicago, Illinois, United States
January 2006 / February 2006 / March 2006 / May 2006 / June 2006 / July 2006 / August 2006 / September 2006 / October 2006 / November 2006 / December 2006 / January 2007 / February 2007 / March 2007 / April 2007 / May 2007 / June 2007 / August 2007 / December 2007 / January 2008 / March 2008 / April 2008 / June 2008 / July 2008 / September 2008 / December 2008 / January 2009 / February 2009 / March 2009 / May 2009 /

Powered by Blogger