Re: catching Runtime Stack Overflow Exception

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

From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 09/02/04

  • Next message: Rob Snell: "Re: no bytes returned on raw socket;trying to implement ping"
    Date: Thu, 2 Sep 2004 21:27:07 +0100
    
    

    assaf <assafwo@hotmail.com> wrote:
    > there must be a way to prevent the application from crashing.
    > the stack-overflowing thread is just a background graphics analysis
    > operation.
    > my system should be able to recover from it.
    >
    > here is its code that blows up the stack:
    > RectangleF[] rects = this._Region..GetRegionScans(this._Matrix);
    >
    > as u can see, it is caused by a Region containing too many rectangles.
    > since a RectangleF is a struct, a value type,
    > the entire array is allocated on the stack.

    No it's not. Arrays themselves are *always* reference types. The values
    will be on the heap. It's more likely that GetRegionScans is recursing
    too deeply.

    -- 
    Jon Skeet - <skeet@pobox.com>
    http://www.pobox.com/~skeet
    If replying to the group, please do not mail me too
    

  • Next message: Rob Snell: "Re: no bytes returned on raw socket;trying to implement ping"

    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: Accessing Command-line text
      ... PROC belongs to HLL. ... that happens very rarly, poluting the stack as you call it, doesnt seem to ... mov eax true ... (A region, inside, is an array of rectangles). ...
      (alt.lang.asm)
    • 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: reference types - is anything at all on the stack?
      ... The data for a reference type object is ) always stored in the heap, but data for value type objects can also be on the heap, if the variable storing the value for the value type is itself in a reference type. ... Value type objects are stored on the stack if the value is held in a local variable, but this is only tangentially related to what makes a value type a value type. ... The really interesting difference between value types and reference types is what happens when you make an assignment of one variable to another: for a reference type, only the reference is copied, allowing the same object to be referred to by multiple variables in the code; for a value type, the entire data of the object is copied, providing each variables in the code with its own copy of the object. ... With that in mind, hopefully you can see that the answer to your specific question is academic. ...
      (microsoft.public.dotnet.languages.csharp)