Re: Read very large file in bytearray and upload to MSSQL
- From: Icemokka <icemokka@xxxxxxxxx>
- Date: Mon, 19 Nov 2007 22:29:12 -0800 (PST)
That's an idea offcourse, but not very optimal.
On 19 nov, 13:54, Family Tree Mike
<FamilyTreeM...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Can't you just find the maximum size file, allocate the array to that size,
and reuse the array in a loop over all files?
"Armin Zingler" wrote:
"Icemokka" <icemo...@xxxxxxxxx> schrieb
Your proposal ( option strict & Cint(lenght - 1 ) fixed my problem.
Now I have a second problem, there are 4 * 600Mb files ready to be
put in the database.
After the first file, I see that my app takes 600Mb of memory (
logic offcourse ).
But I get an out of memory exception on the second file because the
bytearray has not yet released it's memory ( set it to nothing
within the function ).
That's a good question. I'm afraid, I can't answer this. I would have
thought that GC will do it automatically. Do I understand it correctly that
you did set the reference to the array to Nothing /before/ creating the new
array?
I mean,
this
var = nothing
redim var(...)
is not the same as
redim var(...)
because in the 2nd case, first the new array is created before the last
reference to the old array has been cleared. So, the 1st version should be
preferred. Though, I don't know if it helps and if the next Redim will wait
until the GC will have destroyed the previous array.
How can I force that the garbage collector cleans up ( array's don't
have dispose or finally method ).
There's the GC.Collect method, but usually it shouldn't be called manually.
Maybe this is an exception. Let's wait for other answers.
Armin- Tekst uit oorspronkelijk bericht niet weergeven -
- Tekst uit oorspronkelijk bericht weergeven -
.
- Follow-Ups:
- Re: Read very large file in bytearray and upload to MSSQL
- From: Family Tree Mike
- Re: Read very large file in bytearray and upload to MSSQL
- References:
- Read very large file in bytearray and upload to MSSQL
- From: Icemokka
- Re: Read very large file in bytearray and upload to MSSQL
- From: Armin Zingler
- Re: Read very large file in bytearray and upload to MSSQL
- From: Icemokka
- Re: Read very large file in bytearray and upload to MSSQL
- From: Armin Zingler
- Read very large file in bytearray and upload to MSSQL
- Prev by Date: Re: File or assembly name XXX, or one of its dependencies, was not found
- Next by Date: Re: Read very large file in bytearray and upload to MSSQL
- Previous by thread: Re: Read very large file in bytearray and upload to MSSQL
- Next by thread: Re: Read very large file in bytearray and upload to MSSQL
- Index(es):
Relevant Pages
|