#include #include struct LargeObject { LargeObject() { std::memset(blob, 0, sizeof(blob)); } unsigned char blob[10*1024*1024]; }; #if __cplusplus > 199711L #include using std::make_shared; typedef std::shared_ptr LargeObjectPtr; #else #include #include using boost::make_shared; typedef ::boost::shared_ptr LargeObjectPtr; #endif static void* worker(void* arg) { //LargeObject foo; LargeObjectPtr ptr = make_shared(); // LargeObjectPtr ptr(new LargeObject); return 0; } int main(int argc, const char * argv[]) { pthread_attr_t attribute; pthread_attr_init(&attribute); pthread_attr_setstacksize(&attribute, 4096*10); pthread_t thread; pthread_create(&thread, &attribute, worker, 0); pthread_join(thread, 0); return 0; }