Recent Posts
Calendar
November 2013
S M T W T F S
« Oct    
 12
3456789
10111213141516
17181920212223
24252627282930

Posts Tagged ‘StackOverflowException’

Initializing An Array inline

arct-075 This is part two of the discussion I started yesterday about the StackOverflowException, where I explained how memory gets allocated for the different types of variables we have in our systems and how understanding that can prevent the StackOverflowException.  The question came back with some code this time which looked something like this:

private mystruct[] m_struct = 
    new mystruct[6000000];
private mystruct[] GetStructArray()
{
    m_struct[0] = 
        new mystruct(3, 2);
    ...
    m_struct[5900000] = 
        new mystruct(5,4);
}
struct mystruct
{
    public mystruct(int i,int j)
    {
        m_i = i;
        m_j = j;
    }
    public int m_i;
    public int m_j;
}

Read the rest of this entry »

StackOverflowException – What causes this?

ka_vol1_064 Oner Yilmaz Asks:

I am using C# Êxpress developer tool. I Intend to form 3D Mesh object by an array of 60.000 items. When I reach to appr. 19.000 items, I get the error message "An unhandled exception of type ‘System.StackOverflowException’ occurred in Test.exe"
My PC has 2GB RAM.
As for you, what is the reason ?

Read the rest of this entry »