I'm using C++ to write a .XLL plugin for Microsoft Excel, with the help of XLW library. My operating system is windows 7 64-bit version, with 32 GB RAM; but my Excel is Excel 2010, 32-bits version.
Checking with GlobalMemoryStatusEx, it shows that the code in XLL can only see about 1200 MB virtual memory available (from ullAvailVirtual
in struct _MEMORYSTATUSEX), though the physical memory available (ullAvailPhys
) is around 23 GB.
As my code requires quite a lot memory (about 100MB per computation thread), after issuing 12 threads it hits the bad allocation error.
Is there a way to increase the memory available?
XLL
plugin? In a Console Application, GlobalMemoryStatusEx
reports around 2034 MB Virtual Memory available.XLW library
?32-bit Excel
? An XLL is actually just a renamed DLL. If you have a 32-bit Excel, then the whole Excel process has a 32-bit virtual address space to live in (and Windows reserves half of that for the OS). So your process (both XLL and Excel itself), is limited to a total of 2G.
Your choices are:
The latter option is obviously much more complicated, and copying data between processes will not be that snappy - but it is an option.