Fix for #1414 - oom when compiling mongo extension

gcc using all memory when compiling mongo/cursor.cpp