CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: Out of memory

  1. #1
    Join Date
    Jul 2005
    Posts
    218

    Out of memory

    Hello,

    My server is using about 80MB of virtual memory, phisically it usually takes 50M. Sometimes I see a Windows message for my server "Out of memory". The server does not crash or stops operating but this message concerns me.

    I have 1GB of phisical memory and about 600MB is free.

    What could be a reason?
    Thanks

  2. #2
    Join Date
    Feb 2002
    Posts
    4,640

    Re: Out of memory

    You're running out of memory? Seriously, when you constantly "new" and "delete" chunks of memory, your heap becomes fragmented. When you request memory from the heap, it has to be contiguous, so if you make a request, but there isn't enough contiguous memory available, you will get an "Out of memory" error.

    Viggy

  3. #3
    Join Date
    Jul 2005
    Posts
    218

    Re: Out of memory

    OK, and what does it mean? the memory is not allocated? how can I fix it?

  4. #4
    Join Date
    Feb 2002
    Posts
    4,640

    Re: Out of memory

    Yes, the memory is not allocated.

    You can fix this by not allocating / de-allocating so much, or hang onto the memory you've allocated. I don't know if there is a programatic way to "clean up" the heap (I would think this would invalidate pointers that are currently in use).

    Viggy

  5. #5
    Join Date
    Aug 2001
    Location
    Texas
    Posts
    645

    Re: Out of memory

    You might be running out of "Desktop Heap"

    Here's a discussion on the Desktop Heap
    MS Knowledgebase 126962

    There is a utility to check the Desktop Heap at the following
    MS DHeapMon

    I haven't been able to find any discussion on how to verify the Desktop Heap
    other than this utility.

  6. #6
    Join Date
    Feb 2002
    Posts
    4,640

    Re: Out of memory

    Interesting, I was not aware of the "desktop heap".

    Vig.

  7. #7
    Join Date
    Oct 2002
    Location
    Germany
    Posts
    6,205

    Re: Out of memory

    Quote Originally Posted by nazgul27
    My server is using about 80MB of virtual memory, phisically it usually takes 50M. Sometimes I see a Windows message for my server "Out of memory". The server does not crash or stops operating but this message concerns me.
    The word "server" in this context means "service", I presume.

    If so, the the desktop heap may not come into play as most services (especially, better written ones) don't interact with the user i.e. they don't have a window. The Desktop Heap as mentioned in that article is a place where objects like pens, windows, brushes, etc - that are window artefacts are allocated for.
    Last edited by Siddhartha; September 26th, 2006 at 03:30 PM.

  8. #8
    Join Date
    Jul 2005
    Posts
    218

    Re: Out of memory

    no guys, it's not a service, it's just a C++ server I created. I admit that I am using STL intensively and I am holding a lot of info in STL containers. But could that be a problem?

    I am not doing a lot of GUI operations there. THere are two listboxes that are filled with simple text lines.

    I am having troubles with this Desktop monitor software. WHile being installed it requires Win32K symbol file. I found it in my system and feed it to the installer but no good. Still requires it.

  9. #9
    Join Date
    Oct 2002
    Location
    Germany
    Posts
    6,205

    Re: Out of memory

    Quote Originally Posted by nazgul27
    no guys, it's not a service, it's just a C++ server I created. I admit that I am using STL intensively...
    Again - what does this "C++ Server" mean?

    C++ is just a programming language. Did you mean "An Application programmed in C++"? What is it?

    A server is a very specific word when applied to software - like Windows Service (which according to you it isn't one), ATL / COM Server, etc.
    I am holding a lot of info in STL containers. But could that be a problem?
    Without seeing your code, we can't tell.

    In general - STL containers can be used to hold huge amounts of data. However, the nature of the objects stored and the way they are programmed will also influence the way memory is handled. Without looking at code nobody can point fingers at your usage of STL.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured