Stackoverflow during complex math on android
<p>I am using a hough transform to find circles in an image on android. At once point I get a stack overflow:</p>

<pre><code>12-03 16:18:20.999: I/dalvikvm-heap(21563): Grow heap (frag case) to 29.662MB for 2253716-byte allocation
12-03 16:18:21.014: I/dalvikvm(21563): threadid=11: stack overflow on call to Lorg/DTS/boltSizer/ImageProcessing/hystThresh;.hystConnect:VII
12-03 16:18:21.014: I/dalvikvm(21563):   method requires 44+20+12=76 bytes, fp is 0x5e949338 (56 left)
12-03 16:18:21.014: I/dalvikvm(21563):   expanding stack end (0x5e949300 to 0x5e949000)
</code></pre>

<p>Here is where the error is being thrown:</p>

<pre><code>    private void hystConnect(int x, int y) {

        int value = 0;
        for (int x1=x-1;x1&lt;=x+1;x1++) {
            for (int y1=y-1;y1&lt;=y+1;y1++) {
                if ((x1 &lt; width) &amp; (y1 &lt; height) &amp; (x1 &gt;= 0) &amp; (y1 &gt;= 0) &amp; (x1 != x) &amp; (y1 != y)) {
                    value = (input[y1*width+x1])  &amp; 0xff;
                    if (value != 255) {
                        if (value &gt;= lower) {
                            input[y1*width+x1] = 0xffffffff;
                            hystConnect(x1, y1);
                            ran++;

                        } 
                        else {
                            input[y1*width+x1] = 0xff000000;
                        }
                    }
                }
            }
        }

    }   
</code></pre>

<p>I think I understand what it means, but how does one go avoiding this. If you need more of the code being ran just ask.</p>
