Getting Segfaults from running out of stack memory?