c++ - Handle limits in Win 7 application -


i have multithreaded application in c++ windows 7. app compiled dll use of c# app.

i run multithreaded code long hours process streaming data. if compile c++ code stand-alone .exe, , run code, works fine.

but when turned dll , when c# code runs it, program crashes access violation error after long runs. see similar crash when load dll python script , run long hours.

when watch behavior using task manager, see system handle count increasing @ rapid pace. after around 2 hours of code run, see handle count cross 300,000 mark , keeps increasing.

inside multithreaded code, threads being created , teared down continuously. see after thread exited, thread handle not closed explicitly closehandle function. potential problem?

how confirm handles issue. ways watch these system resources in better way? before attempt fixes, know possible solutions test runs take long time, more 5 hours, reproduce crash.

sysinternals process explorer can view handles in process , identify them thread, mutex, file, etc. handles. have closehandle() each thread handle clean them up.

as aside, creating thread expensive operation. if creating lot of thread jobs, better queue jobs , create pool of limited number of threads (usually equal number of cpus in system) pull queue , perform job.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -