Thread: not using virtual memory

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    552

    not using virtual memory

    I want my program to not use virtual memory whatsoever. Is there anyway I can accomplish this without just turning virtual memory off. I tried turning it off but that caused alot of problems. Im using Win98 and VC6
    C Code. C Code Run. Run Code Run... Please!

    "Love is like a blackhole, you fall into it... then you get ripped apart"

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Why on earth would you want to do this? I doubt you could turn it off completely

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    552
    I have a program that uses a lot of memory and it slows to a crawl once it starts going into virtual memory.
    C Code. C Code Run. Run Code Run... Please!

    "Love is like a blackhole, you fall into it... then you get ripped apart"

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Originally posted by *ClownPimp*
    I have a program that uses a lot of memory and it slows to a crawl once it starts going into virtual memory.
    Well without virtual memory it would simply stop dead.....

    Get more ram.

  5. #5
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    If you stop it from using virtual memory and you attempt to access memory outside of what is physically there you will get a page fault which will cause your system to crash - at least in Win98 it will cause it to become unstable.

    Virtual memory is not a direct function of the OS it is a function of protected mode on the CPU which the OS manages. Intel created paging for this very reason. Programs that normally would crash won't, but it does introduce a whole new set of problems but I won't go into them here.

    The OS does monitor the paging mechanism and Windows is in close communication with the system- it can turn it off but it doesn't- so that it does not cause page faults - but as far as I understand my Intel docs, paging to virtual memory is a function of protected mode.

    In the old days you could effectively turn off the paging mechanism by either locking the memory or by using a DPMS that did not use paging. Obviously Windows 'DPMS' uses paging and to turn it off would be nearly impossible. The only way I know to do it is to set your virtual memory size at 0 MB, if possible. But I'm not resposible for what happens when you do that.

    Get some more RAM.

  6. #6
    Registered User
    Join Date
    Jan 2002
    Posts
    552
    looking through my code I noticed a missing &'s for huge list parameters (yikes!) and a couple more missing findclose's (double yikes!, I always forget those). Havent tested the code with those fixes but hopefully that will fix the problem. I knew there was something wrong since I knew there was no way my program could be using up all my 98MB's of ram (yes, I know I need to get some more ram--make that a new computer )
    C Code. C Code Run. Run Code Run... Please!

    "Love is like a blackhole, you fall into it... then you get ripped apart"

  7. #7
    Registered User
    Join Date
    Jun 2003
    Posts
    245
    You can still lock memory pages into memory if you are using WinXP (and have sufficient rights of course), but it is strongly discouraged for anything but drivers that need the memory there and then and can't wait for a possible page fault to fetch the ram back from disk.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory usage and memory leaks
    By vsanandan in forum C Programming
    Replies: 1
    Last Post: 05-03-2008, 05:45 AM
  2. Assignment Operator, Memory and Scope
    By SevenThunders in forum C++ Programming
    Replies: 47
    Last Post: 03-31-2008, 06:22 AM
  3. Question regarding Memory Leak
    By clegs in forum C++ Programming
    Replies: 29
    Last Post: 12-07-2007, 01:57 AM
  4. Virtual Memory utilization during run-time
    By wots_guge in forum C Programming
    Replies: 2
    Last Post: 04-13-2006, 08:17 PM
  5. Exporting Object Hierarchies from a DLL
    By andy668 in forum C++ Programming
    Replies: 0
    Last Post: 10-20-2001, 01:26 PM