2

I'm developing an application which import a lot of data, in some paralells thread.

Sometimes I got the OutOfMemoryException(when I use something like 1.5, 1.7GB of ram).

No big deal, I thought that I will make this a 64bit program(because it's not so huge). But because of a .Net bug(cannot have a primary key in decimal in 64 bits), I just cannot make a 64 bits program.( description of the problem and I found many other case. And I just can't change anything in this database, not even a type or add a view).

I don't need a lot more than the 1.5-1-7GB of RAM. If only I can reach something like 2.5GB, I will be happy.

I read something about the "LARGEADDRESSAWARE", but I didn't find where to set it on my visual studio, and most of other tips where saying that I should modify the boot.ini file.

But since my computer is already a 64bits computers(with something like 8GB of ram), I don't think I've to do something here.

So what should I do to get access to those 3GB of ram?

Community
  • 1
  • 1
J4N
  • 19,480
  • 39
  • 187
  • 340
  • 2
    What are you doing that requires all that to be in memory at once? Just because you are importing data does not mean the data needs, or should, be entirely in ram for the whole processes. "Be a pipe, not a bucket" – Scott Chamberlain Sep 18 '12 at 04:38
  • 32bit application can only address 4gb of ram not 32gb – Daniel Powell Sep 18 '12 at 04:42
  • It's not "at once", it's because I've several parallels process that read and process a variable amount of data. But that's not the point – J4N Sep 18 '12 at 04:43
  • http://stackoverflow.com/questions/2597790/can-i-set-largeaddressaware-from-within-visual-studio – Daniel Powell Sep 18 '12 at 04:44
  • @DanielPowell My bad, I was meaning 3Gb – J4N Sep 18 '12 at 04:44
  • But that is "the point" you are getting a out of memory exception due to having no upper bound on your variable data. If you are loading more data than you are exporting out you need to slow down or stop the import till you have space again. – Scott Chamberlain Sep 18 '12 at 15:43

2 Answers2

1

Use editbin to set LARGEADDRESSAWARE flag like suggested in Can I set LARGEADDRESSAWARE from within Visual Studio?.

editbin /largeaddressaware $(TargetPath) 

You need to run x64 version of Windows or as you've mentioned for 32bit system change Boot.ini to allow apps use 3Gb of address space with /3GB switch.

Community
  • 1
  • 1
Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179
0

A 32 bit application has 4GiB of virtual address space. If I remember correctly Windows by default split that into 2GiB for the application (including code, stack, data) and 2GiB for the system.

There should be a way to change that to 3 GiB for the application and 1 GiB for the system, but I do not think you can go beyond that in any case.

Analog File
  • 5,280
  • 20
  • 23