Jump to content

PoC simulator runs out of threads when built with --enable-pthreads


awise_micron

Recommended Posts

When the PoC simulator is built to use pthreads (which, while not the default, is useful since it allows valgrind to work properly on Linux) then some models, that spawn many threads, cause a simulation when run for a long time to run out of resources with the error:

 

"ERROR - could not create thread"

 

This is because threads are created as joinable threads, but nothing is joining the threads once they've completed, so their resources are not recovered. If the threads are created detached then everything seems to work as expected, because the threads' resources are immediately released as they exit. The following one-line addition in sc_cor_pthread.cpp at line 196 sets the detached state, and resolves the problem:

 

         pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );

 

(See the attached patchfile.)

systemc-2.3.1.patchfile.txt

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...