473,385 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Memory limit?

Hi, I need to use a lot of memory in an aplication. But I get
OutOfMemoryException whenever I try to allocate more than around 1.2GB.
Ex:
byte [] c=new byte[1300000000];
My computer (win xp) have 4GB of RAM memory and it looks like 3GB is free
(Performance Monitor->Available MB).
Is there some way to use more memory for my application?
Greatefull for answers!
Karl Daggfeldt
Nov 17 '05 #1
11 23187
KalleD wrote:
Hi, I need to use a lot of memory in an aplication. But I get
OutOfMemoryException whenever I try to allocate more than around 1.2GB.
Ex:
byte [] c=new byte[1300000000];
My computer (win xp) have 4GB of RAM memory and it looks like 3GB is free
(Performance Monitor->Available MB).
Is there some way to use more memory for my application?
Greatefull for answers!
Karl Daggfeldt


a guess: as you want to allocate one array, the system might want
to use a single contiguous block, which doesn't appear to be there.
So the total number of bytes free could be 3GB, but the largest
single block is less than 1.2GB, therefore you get the exception.

just curious: why do you need this space?

--
Hans Kesting
Nov 17 '05 #2
Thanks for your suggestion!
I have tried to divide the memory in smaller parts (3 parts) , but the
maximal limit do not seem to change. The data is consisting of an image
volume (densly spaced images) of selected parts of the human body (visible
human data). I need the data in memory in order to quickly be able to move
trough the data and turn to arbitrary viewing planes.
Karl Daggfeldt
"Hans Kesting" wrote:
KalleD wrote:
Hi, I need to use a lot of memory in an aplication. But I get
OutOfMemoryException whenever I try to allocate more than around 1.2GB.
Ex:
byte [] c=new byte[1300000000];
My computer (win xp) have 4GB of RAM memory and it looks like 3GB is free
(Performance Monitor->Available MB).
Is there some way to use more memory for my application?
Greatefull for answers!
Karl Daggfeldt


a guess: as you want to allocate one array, the system might want
to use a single contiguous block, which doesn't appear to be there.
So the total number of bytes free could be 3GB, but the largest
single block is less than 1.2GB, therefore you get the exception.

just curious: why do you need this space?

--
Hans Kesting

Nov 17 '05 #3
Apparently it is some sort of .NET limit. Here's a link to another .NET app
which has the same problem. See if their solution will help you:
http://www.runuo.com/forum/showthread.php?t=38360

--
Adam Clauss
ca*****@tamu.edu

"KalleD" <Ka****@discussions.microsoft.com> wrote in message
news:D0**********************************@microsof t.com...
Hi, I need to use a lot of memory in an aplication. But I get
OutOfMemoryException whenever I try to allocate more than around 1.2GB.
Ex:
byte [] c=new byte[1300000000];
My computer (win xp) have 4GB of RAM memory and it looks like 3GB is free
(Performance Monitor->Available MB).
Is there some way to use more memory for my application?
Greatefull for answers!
Karl Daggfeldt

Nov 17 '05 #4

"KalleD" <Ka****@discussions.microsoft.com> wrote in message
news:D0**********************************@microsof t.com...
Hi, I need to use a lot of memory in an aplication. But I get
OutOfMemoryException whenever I try to allocate more than around 1.2GB.
Ex:
byte [] c=new byte[1300000000];
My computer (win xp) have 4GB of RAM memory and it looks like 3GB is free
(Performance Monitor->Available MB).
Is there some way to use more memory for my application?
Greatefull for answers!
Karl Daggfeldt


The address space for your process is limited to 2GB, chance are that no
contiguous block of 1.3 GB is available in RAM due to fragmentation.
When running .NET v1.1, you can take advantage of the 4GT Ram tuning by
adding the /3GB switch to the Boot.ini file. Doing this gives you the
possibility to use 3GB of Ram for the process, of course this is no
guarantee for a successful allocation of such a big chunk, but at least
you'll have more memory that can be allocated.

Willy.
Nov 17 '05 #5
Thank you all!
I think Adam and Will have the answer. I just have not been able to set the
linker setting LARGEADDRESSAWARE on my application. I find nowhere in visual
studio to do this. And I get an error (mspdb71.dll not found) when I try to
use the Link.exe program to make the setting (as suggested in Adams link). I
will look for what component I have to install to get Link working. Unless
anybody know how to make the setting in visual studio?
Karl Daggfeldt

"KalleD" wrote:
Hi, I need to use a lot of memory in an aplication. But I get
OutOfMemoryException whenever I try to allocate more than around 1.2GB.
Ex:
byte [] c=new byte[1300000000];
My computer (win xp) have 4GB of RAM memory and it looks like 3GB is free
(Performance Monitor->Available MB).
Is there some way to use more memory for my application?
Greatefull for answers!
Karl Daggfeldt

Nov 17 '05 #6

"KalleD" <Ka****@discussions.microsoft.com> wrote in message
news:CB**********************************@microsof t.com...
Thank you all!
I think Adam and Will have the answer. I just have not been able to set
the
linker setting LARGEADDRESSAWARE on my application. I find nowhere in
visual
studio to do this. And I get an error (mspdb71.dll not found) when I try
to
use the Link.exe program to make the setting (as suggested in Adams link).
I
will look for what component I have to install to get Link working. Unless
anybody know how to make the setting in visual studio?
Karl Daggfeldt

You can't and don't have to set LARGEADDRESSAWARE for C# applications. All
you need is Net v1.1 and the boot.ini file /3GB switch.
But again this won't garantee you to get a contiguous range of memory of
that size (1.3 GB).
All it brings you is a larger process space, but don't expect you can
allocate more than 1.5 - 1.6 GB in one chunk.

Willy.
Nov 17 '05 #7
Hi Karl, Willy
| You can't and don't have to set LARGEADDRESSAWARE for C# applications.
All
| you need is Net v1.1 and the boot.ini file /3GB switch.
Actually, you can set this, and must if you want to take advantage of > 2GB
of user space:
http://msdn.microsoft.com/library/de...us/vcext/html/
vxlrfVCProjectEngineLibraryVCLinkerToolLargeAddres sAware.asp

| But again this won't garantee you to get a contiguous range of memory of
| that size (1.3 GB).
| All it brings you is a larger process space, but don't expect you can
| allocate more than 1.5 - 1.6 GB in one chunk.

Willy is exactly right. There may not be a chunk in memory of that size
available.

Karl, have you considered a more dynamic data structure, like an ArrayList?
That way the GC can allocate it in as many chunks as it needs.

-Chris

Nov 17 '05 #8
Thanks Chris!
I will try using another memory configuration (but it will have to wait a
while because it means a lot of rewriting). For the moment I gave up on
seting LARGEADDRESSAWARE in visual studio (as instructed from your link). I
got "specified cast not valid" when running my aplication from the Macro
Explorer. Maybe I need c++ installed in order to make it work?

Anyway, after some more reading and trying I was able to set the
LARGEADRESSAWARE from the comand line. For the benifit of anybody
experiencing the same problem I give your the steps I used to make it work on
my system (probably not the most elegant way);

4GB ram needed

1. Add /3GB switch to boot.ini (Start->Control
Panel->System->Advanced->System and recovery Settings->Edit)

Example (2 options at startup):
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Micro soft Windows XP
Professional" /fastdetect /NoExecute=OptIn
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Micro soft Windows XP
Professional 3GB" /fastdetect /NoExecute=OptIn /3GB

2.In order to be able to build from the comand line, run VSVARS32.BAT (in
the visual studio subdirectory: Common7\Tools)

3. Link the program with the LARGEADDRESSAWARE option using the editbin
program;
editbin /LARGEADDRESSAWARE myApp.exe
(first move myApp.exe to the Common7\Tools subdirectory and run the comand
from there)

Thanks again everybody for contributing!
Karl

""Chris Lyon [MSFT]"" wrote:
Hi Karl, Willy
| You can't and don't have to set LARGEADDRESSAWARE for C# applications.
All
| you need is Net v1.1 and the boot.ini file /3GB switch.
Actually, you can set this, and must if you want to take advantage of > 2GB
of user space:
http://msdn.microsoft.com/library/de...us/vcext/html/
vxlrfVCProjectEngineLibraryVCLinkerToolLargeAddres sAware.asp

| But again this won't garantee you to get a contiguous range of memory of
| that size (1.3 GB).
| All it brings you is a larger process space, but don't expect you can
| allocate more than 1.5 - 1.6 GB in one chunk.

Willy is exactly right. There may not be a chunk in memory of that size
available.

Karl, have you considered a more dynamic data structure, like an ArrayList?
That way the GC can allocate it in as many chunks as it needs.

-Chris

Nov 17 '05 #9

""Chris Lyon [MSFT]"" <cl***@online.microsoft.com> wrote in message
news:1X**************@TK2MSFTNGXA03.phx.gbl...
Hi Karl, Willy
| You can't and don't have to set LARGEADDRESSAWARE for C# applications.
All
| you need is Net v1.1 and the boot.ini file /3GB switch.
Actually, you can set this, and must if you want to take advantage of >
2GB
of user space:
http://msdn.microsoft.com/library/de...us/vcext/html/
vxlrfVCProjectEngineLibraryVCLinkerToolLargeAddres sAware.asp

Karl, Chris,

My bad, I thought all managed executable images were largeaddress aware
since v1.1.

Willy.
Nov 17 '05 #10
Thanks for the info Karl.

I have some question.
I extended the memory to 4GB and to apply all the setting as you described
(to the Boot.ini and to my application etc. ).

But the Windows XP Pro OS report only on 3.25 BG instead of the 4GB (the
BIOS does see the 4GB), and I think that this is why my app fail to get more
then 1.2 GB of memory.

Can you tell me in your case what is the amount of memory the Windows OS
reports on and what version of windows OS are you using?
--------
Thanks
Sharon
Nov 17 '05 #11

"Sharon" <Sh*****@newsgroups.nospam> wrote in message
news:21**********************************@microsof t.com...
Thanks for the info Karl.

I have some question.
I extended the memory to 4GB and to apply all the setting as you described
(to the Boot.ini and to my application etc. ).

But the Windows XP Pro OS report only on 3.25 BG instead of the 4GB (the
BIOS does see the 4GB), and I think that this is why my app fail to get
more
then 1.2 GB of memory.

Can you tell me in your case what is the amount of memory the Windows OS
reports on and what version of windows OS are you using?
--------
Thanks
Sharon


As I told you before, Windows XP can NEVER see the whole 4GB of RAM, the
reason for this is that the BIOS maps the hardware devices memory into the
upper range of the 4GB addressable range.
Start "Computer management" , select the Device Manager and watch your
device resources used like Mother boards and Video adapters, you will see
the memory ranges are mapped into the 4GB address range.
For instance if you have a graphics card with 128MB memory, it will probably
be mapped at D8000000-DFFFFFFF, if you have video adapter with 256 RAM, it
will probably be mapped at D0000000-DFFFFFFF.
Other devices like PCI bus and System boards have similar memory mappings,
that means that a part of the 4GB memory space is not usable (not seen) by
the software on a 32 bit OS, in your case its the range above 3.25 GB
(D0000000-FFFFFFFF).

2. The reason that you can't use more than 1.2 GB of virtual memory has
nothing to do with (1). The reason is virtual memory space fragmentation.
Even with /3GB enabled, your VM is fragmented such that, while there might
be 2GB or more free memory , it's not guaranteed that this will be in a
single block.
In general, for a small .NET program, the largest free CONTIGIOUS memory
block (at program start), is something like ~1.4GB, the second largest being
~275 MB. For a /3GB enabled process, the above figures are the same except
that you have an extra free block of ~1GB (above 2GB). As I told you before,
on a 32 bit OS you should never assume to have such large blocks of free
memory, that is, you should never create array's of that size, it will fail.

Willy.




Nov 17 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Zac | last post by:
I've been googling all day and I haven't seen anyone else having this problem, so I thought I'd check to see if I'm unique or I should be expecting this behavior. I've recompiled and reinstalled...
4
by: Frank Esser | last post by:
I am using SQL 8 Personal edition with sp2 applied. I set the max server memory to 32MB and leave the min server memory at 0. When my application starts hitting the database hard the memory usage...
7
by: Jon Trickey | last post by:
We migrated to 8.1 from 7.2 this weekend. Everything ran ok over the weekend, but we have a light user load then (about 200 users.) Today when we had close to 600 users connecting and running...
0
by: Tomas | last post by:
I have two questions: (1) How (if possible) can you, with ASP.NET (and with the IIS 5 included with win2000) specify an maximum limit of the memory that a web application may consume, as an...
3
by: sadanjan | last post by:
Hi , Appreciate if someone can clarify if database Share Memory Limit (2 GB ) in Unix 32 bit boxes is the top limit for all the databases put together in a database or is it for each of the...
13
by: kolmogolov | last post by:
/* Hi, I have removed things irrelevant to reproducing the problem. What's wrong with my code? Thanks in advance for any hint! 1166425362 */ #include <stdio.h> #include <stdlib.h> #include...
1
by: =?Utf-8?B?TWFyY28gU2VsbGFuaQ==?= | last post by:
I need an information. I've a ASP.NET web application on windows2003r2 server with IIS 6. In framework 1.0 memory limit for a worker process is 800MB; in framework 1.1 the limit is 1600MB with...
17
by: frederic.pica | last post by:
Greets, I've some troubles getting my memory freed by python, how can I force it to release the memory ? I've tried del and gc.collect() with no success. Here is a code sample, parsing an XML...
12
by: bomahony | last post by:
Im runnign various versions of DB2 on various UNIX platforms (Solaris / AIX). DB2 is generally eating up about 30% of memory on these systems (4Gb of RAM, which equates to over a gig). i want to...
5
by: Max2006 | last post by:
Hi, What is the limit for memory that a .NET process or AppDomain can use? Thank you, Max
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.