Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

getting out of memory errors at 400MB size when computer has 4G on XP

Posted on 2008-06-23
7
Medium Priority
?
569 Views
Last Modified: 2013-11-20
Hi,
I thought the heap was supposed to just increase indefinitely, but I have a program that generates an "Out of Memory" error at 400MB when the computer has a 4GB. Its running on XP pro, developed with VC++ 6.0 MFC. Any ideas?
 
0
Comment
Question by:longtree
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 14

Expert Comment

by:wayside
ID: 21848057
What is your program doing when you get the error? Are you allocating memory? If so, how much?

Do you have a fixed size pagefile or do you let Windows dynamically manage the size?

How much virtual address space is your program using? On 32 bit Windows you are limited to 1 Gb of user space, IIRC.
0
 

Author Comment

by:longtree
ID: 21849622
I am not sure exactly what the program is doing when it gets the error. My program is only a DLL that runs on a trading engine.
The program runs for a while and every few seconds seems to allocate a few more Megs until it reaches 400MB or so and crashes.
I used leakfinder (http://www.codeproject.com/KB/applications/leakfinder.aspx) to look at the heap at different time points and I couldn't find something obvious that was eating up space.

The paging file size is 5000MB and its managed by windows. In terms of address space its a typical 32bit MFC program ... so nothing out of the ordinary as far as I can tell.

0
 

Author Comment

by:longtree
ID: 21850691
I tracked it with process explorer. When it pops up with the out of memory dialog box, the state of the memory is:

working set 378,284 k (physical memory)

private bytes 560,604k (virtual memory).

virtual size 2,078,592k

0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
LVL 14

Accepted Solution

by:
wayside earned 750 total points
ID: 21855481
> virtual size 2,078,592k

There's your problem. A 32 bit process on Windows can only allocate 2 Gb of user space of the theoretical 4 Gb maximum address space, and the process has grabbed it all. This is independent of how much physical memory the process is actually using (the rest is stored in the pagefile).

You have some kind of massive memory leak somewhere.

I'm assuming this doesn't happen if the program runs without your dll?
0
 

Author Comment

by:longtree
ID: 21857088
The private bytes is the actual virtual memory used .. so why is the virtual size 2G?
0
 
LVL 14

Expert Comment

by:wayside
ID: 21857392
Private bytes is not the same as virtual memory used. Private bytes is the amount of virtual memory that only your process can access, and (I believe) has been been committed. It doesn't include things like the executable portions of the process or mapped files, etc.

IIRC, VirtualAlloc() calls can comsume virtual address space without affecting private bytes,
0
 

Author Comment

by:longtree
ID: 21861967
I found a significant memory leak. Seems to be working now. Tnx for the support!
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question