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 comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...