CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced: Re: [budman] Release memory from threads: Edit Log



KingNothing
Novice

Feb 27, 2012, 3:53 AM


Views: 11943
Re: [budman] Release memory from threads

Hi, sorry for my late reply. Also, sorry for not posting the whole block of code. Here is the whole part where i use threads:

Code
for($a=0;$a<=$counter;$a++){  
if($choice==1){
$thr[$a] = threads->create({'exit'=> 'thread_only'},sub {&ext1::submit($file)});
}
else
{
$thr[$a] = threads->create({'exit'=> 'thread_only'},sub {&ext1::reset($file)});
}
$result[$a]=$thr[$a]->is_running();
}
$sum_a=sum(@result);
while($sum_a!=0)
{
for($a=0;$a<=$counter;$a++){
$result[$a]=$thr[$a]->is_running();}
$sum_a=sum(@result);
}
print("Operation finished\n");

I will check the code you posted and i will come back soon to reply. As you see, i have a while loop which won't stop until the $sum_a isn't zero (when it becomes zero then all threads have finished their job).
Anyway, thank you very much for your interest. I will reply soon to your code.

EDIT
As you see, i don't know what to do after the block of code i posted above where i am pretty sure that the threads have finished their jobs but the memory remains. I really don't know how to release the memory and i have tryed the options in my first post. All the options i have tryed from my first post have been tested after the block of code i posted here in my third post. I would really appreciate it if you could help me somehow with my problem.


(This post was edited by KingNothing on Feb 27, 2012, 4:13 AM)


Edit Log:
Post edited by KingNothing (Novice) on Feb 27, 2012, 3:54 AM
Post edited by KingNothing (Novice) on Feb 27, 2012, 3:55 AM
Post edited by KingNothing (Novice) on Feb 27, 2012, 4:12 AM
Post edited by KingNothing (Novice) on Feb 27, 2012, 4:13 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives