473,385 Members | 1,409 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.

Array Capacity > 2Gb ?

Im making a MD5 file checking program and im trying to read a file which is
larger than 2Gb. and i come across the problem that Arrays in VB.net cannot
have more than 2gb capacity, when i try to create an array of the file
length i get an overflow. is that possible? is there any workaround?

I know its going to be a lot of memory consumming to load all the file into
an array but i just dont care about that.
Any suggestions?

Thanks,
Smoke

Apr 9 '08 #1
4 2620
Christian Reizlein wrote:
Im making a MD5 file checking program and im trying to read a file
which is larger than 2Gb. and i come across the problem that Arrays
in VB.net cannot have more than 2gb capacity, when i try to create an
array of the file length i get an overflow. is that possible? is
there any workaround?
I know its going to be a lot of memory consumming to load all the
file into an array but i just dont care about that.
Any suggestions?
You could read the file in chunks of, say, 32KB (seeing as that's the size
of the OS's buffer AFAIK).

Andrew
Apr 9 '08 #2
You shouldn't need the entire file in memory at once to do that...

"Christian Reizlein" wrote:
Im making a MD5 file checking program and im trying to read a file which is
larger than 2Gb. and i come across the problem that Arrays in VB.net cannot
have more than 2gb capacity, when i try to create an array of the file
length i get an overflow. is that possible? is there any workaround?

I know its going to be a lot of memory consumming to load all the file into
an array but i just dont care about that.
Any suggestions?

Thanks,
Smoke
Apr 9 '08 #3
Well, im reading it in chunks, but anyway i need a array of bytes to use as
buffer to put the read contents and that has to be the total lenght of the
file

"Andrew Morton" <ak*@in-press.co.uk.invalidwrote in message
news:66*************@mid.individual.net...
Christian Reizlein wrote:
>Im making a MD5 file checking program and im trying to read a file
which is larger than 2Gb. and i come across the problem that Arrays
in VB.net cannot have more than 2gb capacity, when i try to create an
array of the file length i get an overflow. is that possible? is
there any workaround?
I know its going to be a lot of memory consumming to load all the
file into an array but i just dont care about that.
Any suggestions?

You could read the file in chunks of, say, 32KB (seeing as that's the size
of the OS's buffer AFAIK).

Andrew
Apr 9 '08 #4
On 2008-04-09, Christian Reizlein <cr*******@hotmail.comwrote:
Thanks you so much for your tips, i where able to override the read method
of the filestream and raise events and control the data beign readed trough
the position property, i didnt figured that out early.

Thanks once again :)
I'm glad it helped :)

--
Tom Shelton
Apr 9 '08 #5

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

Similar topics

7
by: BrianJones | last post by:
In java, to work out the size of an array, say it was called a, you would do a.length which might return 10 as the number of elements. Is there a similar thing you can do in C++? I'd initially...
1
by: Craig | last post by:
Hey Everyone - I'm trying to determine the fastest way of moving array information around and could use some help. Here's the setup: Class A stores a DateTime and an amount (a payment)....
4
by: Peter | last post by:
I run into this situation all the time and I'm wondering what is the most efficient way to handle this issue: I'll be pulling data out of a data source and want to load the data into an array so...
19
by: Tom Jastrzebski | last post by:
Hello, I was just testing VB.Net on Framework.Net 2.0 performance when I run into the this problem. This trivial code attached below executed hundreds, if not thousand times faster in VB 6.0...
10
by: Russell Mangel | last post by:
I have written the following program using VS2005. The program is a Dynamic Array similar to System.Collections.ArrayList in .NET. The program works okay until I reach 65536, I can't seem to figure...
11
by: skumar434 | last post by:
Hi everybody, I am faceing problem while assigning the memory dynamically to a array of structures . Suppose I have a structure typedef struct hom_id{ int32_t nod_de; int32_t hom_id;
3
by: Ant | last post by:
Hi, I'm using an array list as the collection for my indexer (_alPeople). When i try to set _alpeople to a value at a certain index, I get an error. I can't simply add the value as it needs to be...
35
by: Lee Crabtree | last post by:
This seems inconsistent and more than a little bizarre. Array.Clear sets all elements of the array to their default values (0, null, whatever), whereas List<>.Clear removes all items from the...
0
by: dans | last post by:
I want to serialise an array of structs into a MemoryStream so I can pass the contents in a message. I have written something that will Serialize and Deserialize in individual object. Is there a...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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.