c++ - What to do when a DLL needs a bigger stack size than the main exe application? -


i have simulation engine written in visual c++ 2010 , i'm implementing dll plugin based on 3rd party application.

however, stack overflow error when library called 3rd party app's thread. after debugging turned out dll requires bigger stack size thread has. possible extend current thread's stack size somehow?

i know should review simulation engine's code , move big objects heap. problem engine maintained vendor , i'd avoid modifying code if possible.

i'm thinking creating own thread in dll bigger stack size , returning results calling thread when calculation finishes. right approach?

thanks, michal

i'm going suggest first thing check how stack space you're using. allocating large objects on stack? program utilize significant recursion depths? write test hook application can link dll , check how stack space use.

if you're allocating large objects on stack suggest moving them heap.

if you're doing significant recursion may wish investigate using loop heap-based stack maintained dll rather relying on application's stack.

i make these suggestions because it's less intrusive plugin self-contained , not require special stack configuration (or entirely separaate thread have larger stack).


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -