J4N
J4N

Reputation: 20745

Use the 3Gb of memory in 32 bits applications

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?

Upvotes: 2

Views: 3411

Answers (2)

Alexei Levenkov
Alexei Levenkov

Reputation: 100547

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.

Upvotes: 1

Analog File
Analog File

Reputation: 5316

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.

Upvotes: 0

Related Questions