I kept hitting a stack overflow problem when using the PCRE regular expression C library under windows. To fix it, put the following line in PCRE’s config.h to tell it not to use recursion but to use the heap instead. 
#define NO_RECURSE 1
Worked for me.