Home Memory consumption concern regarding asynchronous code in Perl
Reply: 0

Memory consumption concern regarding asynchronous code in Perl

George R.
1#
George R. Published in 2018-02-14 07:04:48Z

I'm running a Perl web server which needs to do some work asynchronously. For this, I use the threads module in the following way:

threads->create(sub {
  # Asynchronous code here
  threads->exit();
});

I have some concerns regarding the correctness of this. Whenever I exit the server, I get the following message:

Perl exited with active threads:
0 running and unjoined
1 finished and unjoined
0 running and detached

I guess this has to do with the fact that I didn't joined or detached my thread. Detaching my thread would be a good solution but, unfortunately, it triggers this: https://bugzilla.redhat.com/show_bug.cgi?id=548249.

Now, here are my questions. Is there any problem with running the thread without joining or detaching it? Is it going to be a memory leak because of the unjoined/undetached threads? Should I run some cleanup code to take care of the finished threads?

Thank you in advance!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.302878 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO