CleanMem experimentation

Discussion in 'other software & services' started by Gullible Jones, Dec 26, 2014.

  1. Gullible Jones

    Gullible Jones Registered Member

    Joined:
    May 16, 2013
    Posts:
    1,461
    Trying this program in a Virtualbox VM (no guest additions, 1 GB RAM) right now.

    It can basically do two things (aside from monitoring): "Clean memory" and "Clean file cache."

    The second is obvious enough, probably the rough equivalent of Linux's vm.drop_caches. That might improve performance, maybe, if Windows likes to swap out program memory to keep the filesystem cache big.

    (Note that a) I don't believe that is the default setting for desktop versions of Windows, and b) Linux is aggressive about maintaining large FS cache sizes, and that only causes bad performance on systems with < 1 GB of RAM in my experience.)

    The first though, I have no idea what on Earth it might be doing. It can't be that deep - the program is written in Visual Basic, I don't think it can even use the Native API! - but according to the task manager, whatever it's doing frees up a little memory... somehow.

    As for performance, I can't tell if it makes any difference at all.

    Next up, testing on a real laptop, and maybe some tracing with GDB.

    Edit: I'm a fool! Sysinternals Procmon should be able to show me what it's doing. Gimme a minute.
     
  2. Mayahana

    Mayahana Banned

    Joined:
    Sep 13, 2014
    Posts:
    2,220
    One of the things I have verified, it fixes memory leaking programs. A few games I play/played had versions that exploded on themselves with memory leaks. Most recently World of Warplanes, everyone would crash after 30-60 minutes running the game. CleanMem kept me paying for hours.

    I know Shane personally. Let me ask him if he minds commenting on this thread, and other places where we discuss his stuff. We've worked together on some projects.
     
  3. Alexhousek

    Alexhousek Registered Member

    Joined:
    Jul 25, 2009
    Posts:
    410
    Location:
    USA--Colorado
    I also know Shane (via email at least) as I've been corresponding with him for several years. I first wrote about Cleanmem probably 3-4 years ago. See http://www.techsupportalert.com/best-free-memory-optimizer.htm

    I actually need to update that page as CleanMem is up to 2.5.0.

    Great little program that works great in XP and Win 7 for sure. I've never had the chance to test it on Win 8 or Linux.
     
  4. Mayahana

    Mayahana Banned

    Joined:
    Sep 13, 2014
    Posts:
    2,220
    Shane's net is down today, so he can't respond. But he said it's in use on 'millions' of computers... He said despite this, some people still bash it, and they usually are ones that haven't tried it.

    Essentially CleanMem triggers windows to be more proactive in memory management using Windows API itself. That's why it works, and doesn't cause crashes.

    So how does CleanMem work?
    CleanMem Works by calling a Windows API. CleanMem doesn't change the working set of a processes. It simply asks Windows to do all the work. So Windows does the trimming, the moving and manages everything. This is why there is never any crashes of programs and any performance hit to the system. To put it short CleanMem doesn't work against the Windows memory manager, it works with it :)
     
  5. SweX

    SweX Registered Member

    Joined:
    Apr 21, 2007
    Posts:
    6,429
    I installed it on a old PC with little ram and it seems to work well.

    But I have question that I tried to find the answer, which are all the "pro" functions exactly that will stop working after 7 days, is there a list somewhere showing
    all the "pro" functions in the program?

    The only answer I found about it was that some settings to the mini monitor is connected to the pro, but there must be more right?
     
    Last edited: Dec 26, 2014
  6. FOXP2

    FOXP2 Guest

    Dig through here:
    http://www.pcwintech.com/cleanmem-help
    But no details on the remote admin/viewer.
    http://www.pcwintech.com/cleanmem-change-log
    Some info on remote admin. Seems like remote viewer is in free.

    And it's buried in the readme file; I'll paste 'em up for those who haven't installed it:

    •With v2.4.0
    You can now view the memory and stats from the mini monitor remotely. You can also run CleanMem from the remote viewer.
    •Pro version introduced with v2.0.0:
    Advanced Monitor Rules: (The user can set these rules for any process they like (Not on protected processes of course)).
    Clean the memory on a specific process when it hits a user set memory level. (Example: Firefox hits 150MB) The mini monitor cleans the memory instead of calling CleanMem. One less program to run :)
    Kill a program if it hits a certain amount of memory.
    Auto set process priority on a process.
    Auto clean the system file cache when it reaches a set size.
    Set how often the advanced monitor rules will run.
    Auto run CleanMem when system hits a user specified % of memory used.
    Great details on running processes.
    Allow users to choose a picture (jpg, bmp, gif) for the mini monitor bar.
    Allow user to choose what text shows on the mini monitor Example: Total memory, used memory, free memory, page file commit, file cache size, system uptime and more.
    Show current file cache info.
    Show extended memory usage stats.


    I bought a couple of licenses about three years ago and those enhancements are sweet. Never used the remote admin, tho.
     
    Last edited by a moderator: Dec 26, 2014
  7. SweX

    SweX Registered Member

    Joined:
    Apr 21, 2007
    Posts:
    6,429
    Thanks for that, it was a bit more than what I found. Yes I'm sure more people will find this list helpful if they are looking for answers.

    Perhaps there is a need for a comparison chart Free vs Pro on the website so people can see the difference between them and find the answers more easily?
     
  8. Gullible Jones

    Gullible Jones Registered Member

    Joined:
    May 16, 2013
    Posts:
    1,461
    Which is why I'm trying it. :)

    Like I said, if that actually works it indicates problems with Windows memory management - at least with how it's configured by default. That's not necessarily an indightment of CleanMem, or of Windows...

    That on the other hand tells me almost nothing, since it doesn't mention which API calls are used.

    Which is why I've attached a Procmon log file to this post, in CSV format. Rename it from .txt to .csv and load it into Procmon and it will show a record of CleanMem's API call activities.

    What does it show, for perhaps a minute of activity following a triggering of the CleanMem executable? From what I can see
    - Several reads/writes to registry keys, some of which look related to memory management
    - Some reads/writes to keys that look related to UI language stuff, not sure why (maybe VB stuff?)
    - Temporary files creation, no idea why.
    - Mapping of lots of Windows DLLs, including some crypto related ones. I'll give it the benefit of the doubt for now, and assume this is VB6 being overengineered.

    So, it seems to do what says, sort of, I guess. And maybe some other stuff. As for performance improvements, I'm typing this in a 1 GB Windows 7 VM with CleanMem running, and it's slow as molasses, but that seems to be the normal state of affairs for Windows on every machine ever these days, never mind on underpowered VMs... Anyway, I can't see any benefit. Maybe you can, or maybe it's placebo, or maybe it's hinky Virtualbox memory management issues interfering with it. In any case, I would invite people who are better versed in Windows internals than myself to look over the Procmon logs.

    Oh, one last note -

    Not sure how that would work, except insofar as it just makes more system memory available that would normally be used for file cache or whatever. If a program malloc()s stuff, and then doesn't free() it, there is not much the OS can do about it. There's no way to know for sure that the allocated memory is not still being used for something.
     

    Attached Files:

  9. clubhouse1

    clubhouse1 Registered Member

    Joined:
    Sep 26, 2013
    Posts:
    533
    Location:
    UK
    I've been using the pro version for a few years now...After reading on many tech websites that memory optimisers were snake oil and usually inhibit performance rather than enhance it, on several occasions the authors suggested CleanMem was an exception that did improve machines with lower ram.
     
  10. FOXP2

    FOXP2 Guest

    Much emphasis is made of the MiniMonitor at PcWinTech and for good reason.

    But the CleanMem executable by itself is a powerful tool that can target specific goals for research or just convenience. It can be run on-demand or enabled in Windows Task Scheduler.

    CleanMem.exe is governed by the CleanMem.ini file. The ini file is built with CleanMem_Settings.exe, the CleanMem Settings Wizard.

    Steps 1 & 2... intuitive.

    What happens between steps 3 & 4 depends on what is selected in 3. The pane for Ignore (shown) or Only will present prior to 4. When all Processes is selected, it goes directly to 4.

    The items for manipulating a Task Schedule in 4 can be ignored.

    Finish escapes the Wizard and the CleanMem.ini is written.

    Different ini files can be built by renaming the CleanMem.ini file before building another. In this way you can create several ini files and by copying the one you want to use and renaming it to CleanMem.ini you can build a purposed library of ini files. The files are quite simple and with a text editor you can become the CleanMem Settings Wizard. ;)

    When CleanMem.exe is run, there is no visual indication of the process. I watch it in Task Manager; it's usually over in a few seconds. If scheduled, you'll need to reference the log files or Task Scheduler's "Last Run Time."

    CM-ini.jpg
     
    Last edited by a moderator: Dec 27, 2014
  11. Hadron

    Hadron Registered Member

    Joined:
    Apr 1, 2014
    Posts:
    753
    I have used this on older machines with much improvement, but I prefer to use it with MiniMonitor rather than Task Scheduler.
     
  12. MrBrian

    MrBrian Registered Member

    Joined:
    Feb 24, 2008
    Posts:
    6,032
    Location:
    USA
  13. MrBrian

    MrBrian Registered Member

    Joined:
    Feb 24, 2008
    Posts:
    6,032
    Location:
    USA
    A user comment from Why is Windows using more memory over time? (my bolding):
     
  14. Pilou42

    Pilou42 Registered Member

    Joined:
    Oct 4, 2014
    Posts:
    64
    U crazy !
    You tell them Windows uses RAM on purpose whereas these folks are persuaded the lowest RAM you use, the better it is. "Freeing RAM" is their leitmotiv.
     
  15. Gullible Jones

    Gullible Jones Registered Member

    Joined:
    May 16, 2013
    Posts:
    1,461
    Okay, someone just sent me a message about what system call it uses. Shane says on another public forum that it's this:

    http://msdn.microsoft.com/en-us/library/windows/desktop/ms682606(v=vs.85).aspx

    Not sure how that would work. Oh wait, more on working set:

    http://msdn.microsoft.com/en-us/library/windows/desktop/ms687398(v=vs.85).aspx

    IOW, it sounds (might be wrong here) like it is unmapping as much process memory as possible. IOW, if there are pages not being used, it lets them vanish from RAM. They don't need to be forced to swap because they are already present on the disk, in the program's executable file.

    If that's the case though, the downside is that they will have to be read back to RAM later if the program does wind up using them.

    So, if I'm correct about this, the upshot is that it's like a "memory nice" command. It will reduce the memory consumption of target programs, slowing them down in the process, but making the rest of the system faster. Like a memory version of Linux's "nice" command.

    It probably won't help with malloc() related memory leaks, but that's a whole other matter...

    Shane - if you're reading this, and it's actually accurate, then I would humbly suggest an improvement... A way of making sure CleanMem runs only against specific memory hungry processes, rather than every user process. I suspect it would be more useful for reigning in certain applications (Firefox, Chrome, memory hogs that don't need high priority).
     
  16. TairikuOkami

    TairikuOkami Registered Member

    Joined:
    Oct 10, 2005
    Posts:
    2,509
    Location:
    Slovakia
    Software like Cleanmem will be always needed, because Microsoft refuses to solve the bug in Superfetch, since he does not even acknowledge it.

    How the Superfetch is supposed to work (simply):

    App A uses 100 MB, Windows preloads its files into 500MB RAM to speed it up. App B requires RAM, Windows frees unused RAM from app A. All is well.

    How the Superfetch actually works (proven by various people, even me, who had problems with memory hugs, insufficient memory warnings and such):

    App A uses 100 MB, Windows preloads its files into 500MB RAM. App B requires RAM, Windows says, 600 MB is used, not enough RAM, App B will fail.

    Microsoft engineers never read details, so they will just say, Superfetch is supposed to take RAM and that is it. They do not care, that there are other bugs, like app, that requires only 20MB for an example, takes more and more RAM over time, until it reaches a few GB and results in crash, because it never release unused RAM.

    So if someone has memory problems, which can not be solved by increasing a pagefile, he can: 1. install Cleanmem or 2. buy more RAM. That is self-explanatory. :)
     
    Last edited: Dec 27, 2014
  17. musings4

    musings4 Registered Member

    Joined:
    Sep 24, 2013
    Posts:
    21
  18. TairikuOkami

    TairikuOkami Registered Member

    Joined:
    Oct 10, 2005
    Posts:
    2,509
    Location:
    Slovakia
    CPU optimizations as well, thanks for the tip, worth checking out. ;)
     
  19. musings4

    musings4 Registered Member

    Joined:
    Sep 24, 2013
    Posts:
    21
    Process Lasso is definitely a great program and always in development. I've purchased a lifetime license over two years ago. There was a memory trimmer in the app called Virtual Trim in which you can periodically set a timer to purged the virtual memory but it reallocates. This new mechanism will essentially determine programs that are persistent RAM hoggers and act accordingly but ignore other programs that aren't. You can do this in Cleanmem via excluding programs as well
     
  20. FOXP2

    FOXP2 Guest

    My oh my... This by far exceeds my every expectation for the work I put into my #10 post here. Especially since MiniMonitor is a completely different tool. No matter, what you prefer is so very special and truly an incredibly significant contribution to this thread! :thumb:
     
  21. MrBrian

    MrBrian Registered Member

    Joined:
    Feb 24, 2008
    Posts:
    6,032
    Location:
    USA
  22. MrBrian

    MrBrian Registered Member

    Joined:
    Feb 24, 2008
    Posts:
    6,032
    Location:
    USA
  23. Gullible Jones

    Gullible Jones Registered Member

    Joined:
    May 16, 2013
    Posts:
    1,461
    @MrBrian, CleanMem does seem to use a different method.

    If I'm reading the API documentation correctly though (and I think I am now), it still doesn't have the intended effect. Since it's freeing clean pages from all applications, not just selected ones, it will just slow down programs that need to read stuff from the disk again later. That may be zero programs, or it may be most of them, depending on your workload.

    If you omit some application from its list, then you're basically letting that application put more of itself in RAM. That may be useful, or it may not.

    Point is, it might work sometimes (or not) but it's still a hack and I wouldn't rely on it. As a more targetted tool for dealing with individual hogs, I think it might be more useful, but still more of a developer tool than an end-user performance improvement...

    Edit: on a purely anecdotal note, I tried it on a spare laptop, and didn't notice any performance improvement there either.
     
  24. wat0114

    wat0114 Registered Member

    Joined:
    Aug 5, 2012
    Posts:
    1,985
    Location:
    Canada
    Maybe it makes most sense to add more memory? Even the developer advocates this approach.

    -http://www.pcwintech.com/about-cleanmem
     
  25. Hadron

    Hadron Registered Member

    Joined:
    Apr 1, 2014
    Posts:
    753
    MiniMonitor calls CleanMem instead of Task Scheduler, so in effect, it is not a completely different tool.