Application to Automatically Free Modified Memory

0

Is there a Windows application or script that can free modified memory belonging to a given application.

I have tried Flush File Cache which is great as a big ol' hammer to clean out all modified memory but I need an application or script that can purge the memory that was allocated for a given application rather than the whole system.

System Specs

Windows 7 64 bit
8 GB RAM
12873 MB PageFile
SuperFetch Turned Off

A bit of background

I have created a Node Webkit application that processes lots of images, creating an image in memory and then discarding it. The initial implementation was leaking memory as I could see the commit size ballooning until Windows started to give out of memory warnings.

After a lot of rewrites the application's commit size stays around a good average and never really goes up, but what happens instead is the modified memory grows steadily (but much more slowly than before). This happens because the application allocates memory for the images and now deallocates them properly. Once the application stops processing the images but is still running, the modified memory slowly goes down back to normal without any intervention. If I run Flush File Cache with the all option it cleans out a whole host of unused memory without affecting my application (although the whole system slows down to a crawl momentarily as expected).

Update
Added a few screenshots to show what happens when 4 of them run simultaneously, nearing the end when free memory is critically low and standby memory is at around 1GB. (apologies, can't post images yet because of my rep in this sub)

standby near 1GB

ram usage after force quit

Hayko Koryun

Posted 2015-02-09T15:43:49.233

Reputation: 228

2Why do you believe this is required? It shouldn't be required. Most memory intensive applications do not do this. Why do you believe you will get any performance boosts from flushing the modified memory? – Ramhound – 2015-02-09T15:46:16.760

I still get out of memory warnings, just much later. However when I purged the memory today the modified memory dropped from a 1GB down to 300MB and everything was still fine. I plan to run multiples of this application on the same machine so the memory will run out much faster and the stuff in modified memory is really not needed. – Hayko Koryun – 2015-02-09T15:50:06.013

Are you running out of virtual memory or physical memory? Because I actually have designed an application similar to yours ( based on the small description ) and didn't have this problem. – Ramhound – 2015-02-09T16:24:06.053

I think both, first the virtual then physical. I have added screenshots to show the state of the RAM whilst running the app and immediately after. – Hayko Koryun – 2015-02-09T20:40:09.907

You have over 1GB free. Have you tried to increase your page file? – Ramhound – 2015-02-09T21:07:45.577

1

so it looks like there's a bug in Chromium when resizing the canvas so it's something I will have to work around, so the original question stands...

– Hayko Koryun – 2015-02-10T08:05:28.973

Answers

0

The "out of memory" warnings are due to running out of commit limit. Windows does not have an error message for running out of physical memory (RAM).

To increase your commit limit, either add RAM or increase your pagefile size.

"Free" pages being "critically low" does not matter. "Standby" is part of "available"; it is just as "available" as "free" is. If you have 1 GB on the standby list then you have plenty of available RAM.

Jamie Hanrahan

Posted 2015-02-09T15:43:49.233

Reputation: 19 777

I know in theory that free and standby are supposed to be equal when it comes to available memory but what I have observed on my laptop and now some of our work machines is that performance is fine with the free memory gradually going to down to 0, but then as soon as it reaches low levels there is performance degradation even though there's plenty of standby memory available. – Hayko Koryun – 2015-07-19T13:15:48.437

Sorry, but your conclusion is incorrect. Standby IS part of available and it is just as "available", just as quickly, as "free" is. Something else must be going on. In any case, I will say again: Your "out of memory" warnings are NOT due to running out of RAM (either "standby", "free", or "available", but rather to running out of commit limit. That is what the "out of memory" message means. It does not mean you are running low on RAM. How are you allocating the space that your program is using for these images? Your symptoms suggest that you are not deallocating the memory in the best way. – Jamie Hanrahan – 2015-07-19T19:50:28.937