Re: Maximum Size of Byte Array

Tech-Archive recommends: Fix windows errors by optimizing your registry



Thank you for your answer!

I had already setup this setting in the processmodel-section to 90% but
there is still the same behavior.

If I allocate a 400 MB byte array I Do need this axact size because the
file has this size. I do not allocate 400 MB in every case of course.

The idea to trade the image in chunks is very good.
But I do not know how to load an image in chunks into memory, which
could be compressed (perhaps a jpeg file).

I probably have to decompress this chunk and convert it into a Bitmap
and then save it to Harddisk as chunk "xy".

Is it even possible to work with a compressed chunk of a jpeg file? How
can I determine wich size (height and width) this chunk has (I would
need this info to put the chunks together again after resizing them)

sorry for so many questions...But perhaps you can help again...

Thanks in advance


--
Gerrit Horeis

Software Developer
CI-Gate Development & Consulting GmbH
http://www.ci-gate.de
http://www.xira.de
http://www.bitbauer.de



Karl Seguin [MVP] schrieb:

Gerrit:
I got a good laugh out of this one :)

You can change ASP.NET to use more memory in the processModel...it's set to
60% by default...you can up it..but you'll run into a win32 2gig process
limit (60% of 2.5 is 1.5..so you might be able to get 1.8..but I wouldn't
push it more than that).

Seriously though, some suggestions:

1 - Atleast consider a generic List<Byte> which can have it's size
allocated dynamically..so if you only need 100 mb's, you don't need to
allocate any more.
2 - Is it at all possible to process these images in smaller chunks? or do
you need to do everything all at once?

Also, I THINK depending on where this is defined, the allocation might
happen on the stack instead of the heap...which is much smaller. I'm just
guessing here. I'm I'm right, you'd certainly run up against a limit at 420
megs. The solution might be to define test as an object field...which will
then make it get allocated on the heap..

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/


"Gerrit" <Gerrit.Horeis@xxxxxx> wrote in message
news:1159282299.342729.146500@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thank you for your advice!

But I need to use this big array. In my application I want to generate
thumbs and previews from uploaded images and I do not expect that these
images are greater than 100MB in normal case. But in some cases these
images can be about 1 GB. (Perhaps every 6 Month...)

My PC has 2,5 GB of RAM and it's although not able to generate this
array. What do I have to do to make this possible. Is there any system
property in the machine.conig or something else I could do?

Thanks in advance

--
Gerrit Horeis

Software Developer
CI-Gate Development & Consulting GmbH
http://www.ci-gate.de
http://www.xira.de
http://www.bitbauer.de


Mark Fitzpatrick schrieb:

ASP.Net 2.0 could be protecting the memory of the server better. That's a
400 MB byte array, which for a lot of servers could be 20% of the
available
memory if not more. That could be fine for one and only one user and page
instance, but what happens if even two users work the code that requires
a
400 MB byte array allocated. I'm not exactly sure if that's a feasible
array
size for a server environment which could be why it's not letting you do
it.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"Gerrit" <Gerrit.Horeis@xxxxxx> wrote in message
news:1159275482.250893.128310@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi all,

I'm getting an OutOfMemoryException when I initialize a byte array in
C# like this:


Byte[] test = new Byte[420000000];


I'm using ASP.NET 2.0. In ASP.Net 1.1 it works fine. So what am I doing

wrong?

What is the maximum length of a byte array?

Can somebody help me? Thanks in advance!

--
Gerrit Horeis

Software Developer
CI-Gate Development & Consulting GmbH
http://www.ci-gate.de
http://www.xira.de
http://www.bitbauer.de



.



Relevant Pages

  • Re: arrays of strings and pointers
    ... >> that acts like 2-dimensional array. ... >> If you want a fixed number of variable-size arrays, ... > allocate each row separately; you can allocate one big chunk, ... I was assuming a potential need to reallocate the individual chunks, ...
    (comp.lang.c)
  • Re: Cons cell archaic!?
    ... from s-expression or XML or other syntax you keep the bloated array ... For using vectors to emulate lists that ... Allocate 2, move 1 element: ... What do you think of that algorithm? ...
    (comp.lang.lisp)
  • Storing/Retrieving TYPEs with ALLOCATABLE components (TR) (long)
    ... tBrd, including array descriptor of tEn )). ... Without previous DEALLOCATE, the allocate line fails at run time with message ... the fact that I'm loading an invalid descriptor tBrd%tEn from the file... ... status (which is not possible according to Standard, but then BINARY files ...
    (comp.lang.fortran)
  • Re: Storing the size of an array in the structure itself
    ... >> I think every C programmer can relate to the frustrations that malloc ... >> the size of an array must be stored separately to be a nightmare. ... is anything more than just that - a chunk of memory. ... > Otherwise you couldn't tell it how much to allocate. ...
    (comp.lang.c)
  • determining available space for Float32, for instance
    ... I am looking for a way to determine the maxium array size I can allocate ... We do not want a solution that requires recompiling Python, ... agents may be households that choose a new gridcell to live in. ... Each attribute of a dataset has such a 2D array. ...
    (comp.lang.python)