0

First some background. I'm building a 32-bit application but running on 64-bit windows.

The application loads a bunch of files for graphical rendering and is multithreaded.

The problem is that I am getting bad allocation errors when the application reaches around 1.5GB. This boundary varies widely from 1.5GB to 1.8GB and never seems to approach the 2GB single application memory boundary I would expect it to.

The application itself is multithreaded and in my testing it seems to be able to allocate more memory if I remove one of the threads.

Is there a reason I am unable to allocate up to the full 2GB??

Note: GPU memory usage is around 400MB and even if I turn off the rendering the issue is still there.

Thanks in advance for any help!

  • The process has other memory allocated..? Memory address fragmentation..? What language / allocation call (including size of allocation request)? – user2864740 Aug 28 '18 at 22:25
  • Possibly relevant: https://stackoverflow.com/q/3770457/2864740 , https://stackoverflow.com/q/79923/2864740 – user2864740 Aug 28 '18 at 22:28
  • C++, memory allocation happens internal to DLL so I can't be sure on allocation call. I assume 'new'. Fragmentation should be minimal since it's during the load phase and there is not a lot of delete going on. The files are about 5 - 10 MB each (graphical files) with one file loaded at the very beginning being around 300 MB – Steve Powers Aug 28 '18 at 23:01
  • Sorry, but without [mcve], using which we can reproduce the issue, it is difficult to suggest something concrete. You say, you load large files during initialization. The only this fact signals that you **have** memory fragmentation (unless you implement reading the files using low-level functions). – Tsyvarev Aug 29 '18 at 07:32
  • On a 64Bit Windows a 32Bit Process can use 2GB memory, when using /LARGEADDRESSAWARE up to 4GB (http://msdn.microsoft.com/en-us/library/aa366778.aspx). But maybe you're using a library who expects the top bit of pointers to be zero. So getting a out of memory exception around 1.5 - 1.8 indicates memory fragmentation. You should check your code for that. – user743414 Aug 29 '18 at 12:24
  • I don't really need help with my code, this is more of a theoretical question. Adding LARGEADDRESSAWARE does solve the issue but I'm worried about instabilities with older DLLs if I set this value. Does a 32-bit app have to run in just the first 4GB of system memory or can it use memory outside of the first 4GB of address space? Memory fragmentation should be fairly minimal as I don't do much memory deletion until the application's exit. The app basically opens and loads a bunch of large graphical files and then delets on exit. – Steve Powers Sep 05 '18 at 20:32

0 Answers0