Archived

This topic is now archived and is closed to further replies.

bobatefrei

Free windoz memory

Recommended Posts

The windows OS uses a large amount of memory, how can I free this stupid things just while my 3D apllication is running? And How do I get the best thread ressource? PS: I''m using OpenGL

Share this post


Link to post
Share on other sites
You need to understand more about how Windows works!

1. So you believe OpenGL under Windows talks to your graphics card without the OS ??? - wrong.

2. Windows uses virtual memory - if no code currently running on the system is using Windows, then none of the memory (apart from kernel mode memory used by drivers) used by Windows will be taking physical RAM!!!

3. Threads and their priority are implemented by the OS, so getting rid of the OS kindof wouldn''t work!. You could bump up your process priority a small amount, but it wouldn''t do very much except steal resources from other running threads (so your overall performance may be lower!).

On all the commercial products (games & multimedia), demos etc I''ve worked on or have seen the code to, I''ve never needed to increase the thread priority or kill the OS to get back resources to increase application performance! - its not the way Windows PCs work or how to get the most out of them.

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
I just want to force windows to unload the unused things like some DLLs BEFORE my application starts to use memory. It''s just to prevents the use of virtual memory...

I never wanted to kill windows (quoique)!

Share this post


Link to post
Share on other sites
It''s not nice, but you could first query the system for the ammount of physqical memory and then attempt to allocate and lock large chunks of memory in your aqpplication. All you need to do is write all 1''s to the memory and then release the whole thing. The key is to make sure the memory is LOCKED. If you cannot get a lock on the memory then you need to back off it''s the sytems nice way of telling yoqqu tqhaqt you aqre trying to allocate too much.

This will force windows to flush low priority memory to disk, this includes disk buffers and some unused dll''s.

Honestly though, this is going to alot of effort for something you should never need to do or know about. If you are having memory issues with your application you should first attempt to clear up your application first before attempting to override basic OS skills like VM. You might need to read up on basic multimedia tricks like the pre-touch thread that MS has used for years.

Pre-touch thread trick.

Having a seperate high priority thread in your application that knows what data you WILL ( within the next second ) need. It then goes and reads that data to force the data to be in physical memory when the appication goes around to accessing it. This works best for multiledia where it is generally accessed in a linear fasion, but can be applied to almost any type of application where data needs can be anticipated.

Good luck

Share this post


Link to post
Share on other sites
Why dont you just exit all programs before running your game. You can hit ctrl-alt-del to see what is all running, all you "need" in there is Explorer and Systray. Anything else running is using up system resouces. But there is no automatic way to exit these programs from within another program.

Possibility

Share this post


Link to post
Share on other sites
There are heaps of "ram cleanup" programs, but all they''re doing is allocating and locking a large amount of memory, filling it with 1''s, and releasing it.

I''ve tried out two such programs. One was limited shareware, and the other wasted far too much cpu time if it was left running in the system tray. 82% cpu usage? Come on!

But reduce your application''s memory usage before forcing windows to do anything.

Share this post


Link to post
Share on other sites