Stack overflow occurs when recursive calls eat up all the stack space, so minimizing the variables in those routines and the data passed down, could help. Also try to optimize the recursion or your algorithm to minimize the number of recursive calls or see if you can rewrite your routines to use tail-recursion
Check your code to see if you have an infinite recursion with no break point(s), most of the recursive algorithms are not memory hogs seldom go deeper than a few levels.