473,958 Members | 5,400 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

large arrays and system.outofmem oryexception

assuming I have 2GB memory. And 1.5GB available.

dim c1(,) as byte
redim c1(1000, 1024*1024)

throws system.outofmem oryexception. I'm like... huh? Initially I thought a
lot of space is taken up by GC. So, I up my memory to 4GB. Same thing....

So, I read microsoft documents on this type of exception. Doesn't help much.
They were saying to try and keep arrays to 64KB. But, that's not much to work
with.

I suspected that it's gotta do with 'available contiguous memory' and not
just the total available memory. For example,

redim c1(800, 1024*1024)
redim c2(200, 1024*1024)
may work but not...
redim c1(500, 1024*1024)
redim c2(500, 1024*1024)

can someone shed some light on this? Sound like a .net memory oddity. ASP
..net seems to have similar problem (not with arrays though)
Mar 29 '06 #1
6 4321
Chad,

If I have this kind of problems, than I start to investigate in what kind of
a table will work and in what format not.

However, probably is this what you are looking for.

http://msdn.microsoft.com/library/de...ram_tuning.asp

I hope this helps,

Cor

"chad" <ch**@discussio ns.microsoft.co m> schreef in bericht
news:3C******** *************** ***********@mic rosoft.com...
assuming I have 2GB memory. And 1.5GB available.

dim c1(,) as byte
redim c1(1000, 1024*1024)

throws system.outofmem oryexception. I'm like... huh? Initially I thought a
lot of space is taken up by GC. So, I up my memory to 4GB. Same thing....

So, I read microsoft documents on this type of exception. Doesn't help
much.
They were saying to try and keep arrays to 64KB. But, that's not much to
work
with.

I suspected that it's gotta do with 'available contiguous memory' and not
just the total available memory. For example,

redim c1(800, 1024*1024)
redim c2(200, 1024*1024)
may work but not...
redim c1(500, 1024*1024)
redim c2(500, 1024*1024)

can someone shed some light on this? Sound like a .net memory oddity. ASP
.net seems to have similar problem (not with arrays though)

Mar 29 '06 #2
hey Cor, thanks for the reply.
http://msdn.microsoft.com/library/de...ram_tuning.asp
Ah, the /3GB thing. Yes, that was the first thing I tried after upping the
memory from 2 to 4GB. Didn't work though. But, I seriously doubt that it's
got anything to do with total memory.

I think that .net just can't handle arrays that size :(

Before I upped the memory, outofmemoryexce ption crashed out at 800MB of
array size. After upping to 4GB, it's still 800MB. So, I don't think it's the
total physical memory. I investigated page file size too, as well as stopping
unnecessary processes. Same thing. Oh well, sounds like recoding is the way
to go. I'm just curious why it's like this.



"Cor Ligthert [MVP]" wrote:
Chad,

If I have this kind of problems, than I start to investigate in what kind of
a table will work and in what format not.

However, probably is this what you are looking for.

http://msdn.microsoft.com/library/de...ram_tuning.asp

I hope this helps,

Cor

"chad" <ch**@discussio ns.microsoft.co m> schreef in bericht
news:3C******** *************** ***********@mic rosoft.com...
assuming I have 2GB memory. And 1.5GB available.

dim c1(,) as byte
redim c1(1000, 1024*1024)

throws system.outofmem oryexception. I'm like... huh? Initially I thought a
lot of space is taken up by GC. So, I up my memory to 4GB. Same thing....

So, I read microsoft documents on this type of exception. Doesn't help
much.
They were saying to try and keep arrays to 64KB. But, that's not much to
work
with.

I suspected that it's gotta do with 'available contiguous memory' and not
just the total available memory. For example,

redim c1(800, 1024*1024)
redim c2(200, 1024*1024)
may work but not...
redim c1(500, 1024*1024)
redim c2(500, 1024*1024)

can someone shed some light on this? Sound like a .net memory oddity. ASP
.net seems to have similar problem (not with arrays though)


Mar 29 '06 #3
"chad" <ch**@discussio ns.microsoft.co m> schrieb:
Before I upped the memory, outofmemoryexce ption crashed out at 800MB of
array size. After upping to 4GB, it's still 800MB. So, I don't think it's
the
total physical memory. I investigated page file size too, as well as
stopping
unnecessary processes. Same thing. Oh well, sounds like recoding is the
way
to go. I'm just curious why it's like this.


IIRC ~ 800 MB was the per-process memory limit for .NET 1.*, and maybe still
is for .NET 2.0.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Mar 29 '06 #4
> IIRC ~ 800 MB was the per-process memory limit for .NET 1.*, and maybe still
is for .NET 2.0.
oh I see. that explains it then :-)
thank you very much.

"Herfried K. Wagner [MVP]" wrote:
"chad" <ch**@discussio ns.microsoft.co m> schrieb:
Before I upped the memory, outofmemoryexce ption crashed out at 800MB of
array size. After upping to 4GB, it's still 800MB. So, I don't think it's
the
total physical memory. I investigated page file size too, as well as
stopping
unnecessary processes. Same thing. Oh well, sounds like recoding is the
way
to go. I'm just curious why it's like this.


IIRC ~ 800 MB was the per-process memory limit for .NET 1.*, and maybe still
is for .NET 2.0.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Mar 29 '06 #5
"chad" <ch**@discussio ns.microsoft.co m> schrieb:
IIRC ~ 800 MB was the per-process memory limit for .NET 1.*, and maybe
still
is for .NET 2.0.


oh I see. that explains it then :-)


Additional information on this topic can be found here (text is in German,
but links reference articles written in English):

<URL:http://groups.google.d e/group/microsoft.publi c.de.german.ent wickler.dotnet. csharp/msg/1e14bd8b0886e36 c>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Mar 29 '06 #6
<URL:http://groups.google.d e/group/microsoft.publi c.de.german.ent wickler.dotnet. csharp/msg/1e14bd8b0886e36 c>

Awesome! Especially the 2nd article. It explains a lot about memory issues.

thanks again. You're the best :-)
"Herfried K. Wagner [MVP]" wrote:
"chad" <ch**@discussio ns.microsoft.co m> schrieb:
IIRC ~ 800 MB was the per-process memory limit for .NET 1.*, and maybe
still
is for .NET 2.0.


oh I see. that explains it then :-)


Additional information on this topic can be found here (text is in German,
but links reference articles written in English):

<URL:http://groups.google.d e/group/microsoft.publi c.de.german.ent wickler.dotnet. csharp/msg/1e14bd8b0886e36 c>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Mar 30 '06 #7

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

Similar topics

0
2796
by: Per Bergland | last post by:
After many woes, I finally managed to get a stack dump of my System Service (written in C#) that insists on crashing when launched at system boot time (see below on how to get this dump - I couldn't find any info on how to do this). Here's the stack trace from cordbg: Unhandled exception generated: (0x04719c94) <System.Runtime.Remoting.RemotingException> _className=<null> _exceptionMethod=<null>
3
6171
by: Mohd Banat | last post by:
hello, I get XXX when I run the following code (if and only if the outcome of transformation is beyond 20 MB) With _Xslt .Load(XslFile) .Transform(XmlDocument, Nothing, MyWriter, Nothing)
2
3289
by: Fernando Casero | last post by:
Hi, I'm programming on Visual C# Express Beta 2 and I have the following code: class MyClass { int a = new int int b = new int public int SomeMethod() }
9
35339
by: haibhoang | last post by:
I have a Windows Service that is trying to parse a large (> 1Gig) text file. I am keep getting OutOfMemoryException exception. Here is the code that's having problem: using (StreamReader streamReader = new StreamReader(stream, Encoding.ASCII)) { string line = ""; DateTime currentDate = DateTime.Now.Date; while (streamReader.Peek() > -1)
1
3461
by: Ripul Handa | last post by:
Hi We are running IIS 5.0 cluster with cisco local director. We are running a website on 2 webservers and I have been observing that from past few days we have are getting this error message of and on Error Messag Remote IP:66.122.242.6 Host:216.211.212.2
1
5009
by: SMG - Idealake | last post by:
Hi all, I am getting following error on my error, what could be the reason? Exception of type System.OutOfMemoryException was thrown. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.OutOfMemoryException: Exception of type System.OutOfMemoryException was thrown.
1
3911
by: Ashkan Daie | last post by:
Hi All, When trying to install a performance counter via InstallUtil I get the following exception: Creating performance counter category Enterprise Library Caching. An exception occurred during the Install phase. System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was
2
4321
by: =?Utf-8?B?SnVzdCBjbG9zZSB5b3VyIGV5ZXMgYW5kIHNlZQ== | last post by:
Hello All i am trying to read a large txt files -may 1 GB-, which coze my program to hang, and i need to know if there are techniques that make this without hang and do it faster if you know something can help. please tell me. that is my code , and i had run it for a txt file its size is 423 MB, and i left my PC opened and in the next day i found that it records about 10 hours and large number of lines about 500000 line and also i got...
8
12593
by: =?Utf-8?B?UGlnZ3k=?= | last post by:
Hi to all, I am getting this System.OutOfMemoryException calling the Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(<stream>,<Obj>) method. The type of <streamis IO.MemoryStream =====Exception: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
0
10053
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11676
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
11454
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10768
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9975
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7506
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
5035
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4622
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3629
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.