1

I have an old Doc/View C++/MFC app that is developed using VS 6. I use Stingray Objective Grid 8.01 Pro as my data grid.

Recently, our "job" sizes have gotten much larger; and this is when the Out of Memory errors started showing up.

Here is the scenario that gives me the out of memory error:

FYI, when I say I load a job in the scenario below; it means that I read a DB and load the data associated with that job into memory using custom classes that hold the data in CArray and CList objects; which is stored in the document class. In addition, I store some of that data in two StingRay grids on the main View for that document.

When I first open the application, it shows about 21 MB memory usage in Task Mgr. I start by loading a typical job and the app goes to around 40 MB. I then load a "large" job and then application grows to around 159 MB. Next, I close the "large" job and the application drops to around 40 MB. I then load the same "large" job again and it goes back to around 159 MB. I then open a modeless window that contains a StingRay grid and fill the grid with data from the job. When that is doen, the application memory usage jumps to around 1,421 MB. I then close the modeless window and it goes back to around 163 MB. I then close the "large" job and it goes back to around 45 MB. I then try to reopen the same "large" job and when I starting reloading the Stingray grids on the main window (not the modeless window), I get an Out of Memory error. At that point, the application is showing about 170 MB in Task Manager.

Since I can close and reopen jobs without any issue, I can only assume that when I am loading the data into the Stingray grid in the modeless window; that something is not getting freed; but if that is the case, why is my memory usage in Task Manager seem to be going back to a nearly normal level after I close the modeless window. It is only about 5 MB larger after I close the modeless window.

What I really need is some suggestions on how to try and identify why I am getting this out of memory error when my app has only used 160 MB when it says out of memory.

Any help would be appreciated.

Thanks,

Phil

1 Answers1

1

Getting 1,421 MB when loading the grid is uncomfortably close to the 2GB address range that you are allowed in a 32-bit app. The surefire solution, of course, is to become a 64-bit app, if that is possible. Another thing you could try is to use the grid's virtual mode, so the grid does not have to duplicate the data. In the virtual mode you get a callback for each row or cell to be painted and you give it the data from your document storage.

ScottMcP-MVP
  • 10,337
  • 2
  • 15
  • 15
  • I agree that 1,421 is dangerously close to the 2 GB limit and I have implemented virtual grids in the next release and was successful in reducing my memory footprint by more than half. I now max out at around 500 MB when loading the grid that was previously nearing and in some cases, exceeding the 2 GB limit. However, I am still concerned by the out of memory errors when my application is only reporting 160 MB of use. I feel like I am missing something as one tester of the new version that uses virtual grids is still reporting the occasional Out of Memory error. – Phillip Price Mar 21 '14 at 12:43