running out of memory (I think) - how do you use virtual memory?

This is a discussion on running out of memory (I think) - how do you use virtual memory? within the Windows Programming forums, part of the Platform Specific Boards category; I have a program that loads images (very large ones - 25MB a piece - about 180 MB total), gathers ...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    72

    running out of memory (I think) - how do you use virtual memory?

    I have a program that loads images (very large ones - 25MB a piece - about 180 MB total), gathers a bunch of information, then creates three images (about 15 MB a piece) & writes them out to disk.

    It's designed to create three images. If I try to run the program on machine A, it dies. If I do it on machine B, it runs to completion (and creates all three images). If I only make the program create one image, it works on both machines.

    Machine A has 512 MB RAM. Machine B has 1 GB RAM. Because of this, my guess is that the lack of RAM in machine A is what's causing the problem, however, shouldn't the program just start using virtual memory if it runs out of system memory? Do I have to tell it to do that explicitly? I thought the OS took care of things like that. If I have to do it explicitly, how would I do that (I'm fairly new to Windows programming - I've done almost all Linux/Irix up to now)?

    I'm using MSVC .NET on Win XP Pro SP1 (both machines). The program is MFC based.

    Thanks.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,607
    >> my guess is that the lack of RAM in machine A is what's causing the problem

    Use a debugger and stop guessing.
    It's easier to come up with a solution once you know what the problem is.

    gg

  3. #3
    Banned maes's Avatar
    Join Date
    Aug 2001
    Posts
    744
    Why don't you save a bitmap to file ones you're finished with it and load them back into memory once you need it again.
    And create temporry file for those that you create.

    It will be slower but you won't run out of memory
    SVG is the future

  4. #4
    Registered User
    Join Date
    Oct 2002
    Posts
    72
    Quote Originally Posted by Codeplug
    Use a debugger and stop guessing.
    It's easier to come up with a solution once you know what the problem is.
    FFS! Thank you for knocking some common sense into me.

    For the record, I had actually used the debugger, saw that the problem lay in a system file after going through the kernel & mfc dll's, and figured it was a memory issue. Tracing the stack back showed that it wasn't.

    I'm still a bit baffled as to why it worked on one machine and not on another. Furthermore, it died on a delete of a char array that was seemingly properly allocated with new. Oh well, the char array was only there temporarily (for the purpose of debugging another issue)... with it out, we're happy.

    Thanks again.

  5. #5
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,607
    >> it died on a delete of a char array that was seemingly properly allocated with new

    If the pointer value passed to delete is the same pointer value returned by new, that's usually an indication that some other code is stomping around where it shouldn't........those are the fun bugs

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Mutex and Shared Memory Segment Questions.
    By MadDog in forum Linux Programming
    Replies: 14
    Last Post: 06-20-2010, 04:04 AM
  2. tools for finding memory leaks
    By stanlvw in forum C++ Programming
    Replies: 4
    Last Post: 04-03-2009, 11:41 AM
  3. Assignment Operator, Memory and Scope
    By SevenThunders in forum C++ Programming
    Replies: 47
    Last Post: 03-31-2008, 06:22 AM
  4. compilation error - virtual memory exausted
    By yevgeny in forum C Programming
    Replies: 1
    Last Post: 11-19-2001, 11:59 AM
  5. Exporting Object Hierarchies from a DLL
    By andy668 in forum C++ Programming
    Replies: 0
    Last Post: 10-20-2001, 01:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21