Re: StackOverflowException.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Moved the thread to microsoft.public.dotnet.framework as "Stack Memory Leak
in C#".

Please feel free to keep continue responding here if you wish.

--ROBERT

"Robert Bouillon" <djwhizzard@xxxxxxxxxxx> wrote in message
news:euuGOzbSFHA.3944@xxxxxxxxxxxxxxxxxxxxxxx
> I have a StackOverflowException that's NOT caused by a recursive function.
> I'm having a hard time with this exception as it takes about an hour to
> reproduce, and I'm not sure what's causing it.
>
> I have a serial stream class that reads bytes from a serial port. The
> information is stored in a local byte array of about 4k. When I'm done
> processing the data, the byte array is assigned to an object property that
> serves to retain a record of the bytes transferred. I think this may be
the
> problem.
>
> I know that locally declared byte arrays are stored on the stack. Am I
> mistaken in thinking that assigning a byte array to an object property
boxes
> the array (Because the object exists on the heap)? If so, then this is my
> problem. How do I box the array while keeping it strong-typed?
>
> If assigning a byte array to a class property (on the same thread) DOES
box
> the array, then I'm at a loss to the problem. Are there any tips or tricks
> to determining what exactly is being stored on the stack?
>
> Of course because error handling requires stack space, and my stack is
> invalid due to an overflow, it's very difficult trying to track down this
> bug.
>
> EXAMPLE CODE (Short version: not actual code. Just to demonstrate how my
> code handles the array):
>
> do{
> byte[] buffer = new byte[4196];
> p_Stream.Read(buffer,0,4196);
> DoStuff(buffer);
> DataRecord dr = new DataRecord();
> dr.Data = buffer;
> } while(i++<500)
>
> Thanks
> --ROBERT
>
>


.



Relevant Pages

  • Re: Doc/View question
    ... elements in the array to get how many bytes of stack space it requires. ... sequence of bytes that is long enough to hold the entire contents of the array. ... data type" for this purpose! ... So then it appears that I can put structs of different member types into CArray ...
    (microsoft.public.vc.mfc)
  • Re: I dont understand the definition of DOES>
    ... on stack on code entry). ... You can use DOES to make ARRAY and then use ARRAY ... CREATE CELLS ALLOT ... First you'd make the code that will execute on the child word. ...
    (comp.lang.forth)
  • Re: a kind of an assumed-shape array leads to a sig11
    ... extent of an array in a subroutine bad practice? ...    end module bar ... default stack size limits on many current systems. ... Some compilers have options to avoid putting large automatic arrays ...
    (comp.lang.fortran)
  • Re: Globally declared arrays
    ... I noticed that my colleague was declaring local arrays on the stack, ... What is a "global array on ...
    (comp.lang.c)
  • Re: Use of PICK and ROLL
    ... An array, in contrast, may be accessed at any point: ... PICK and ROLL are therefore array operations, not stack ... I thuoght the point was that if you needed to change the search order ...
    (comp.lang.forth)