I thought I had the same problem but it turns out that it was my code that 
caused it, it's probably the same thing here. 
check this thread for more 
details: https://github.com/nodejs/node/issues/3560#issuecomment-151895278


On Monday, October 26, 2015 at 4:30:42 PM UTC+2, Karim Benjelloun Herrera 
wrote:
>
> Hello everyone, I have a question that I still haven't found the solution 
> for it. So I would like to ask here if someone knows how to solve it.
>
> I am making a C++ addon for Node. And I would like to run 
> uv_queue_work multiple times without having to use a while/sleep the main 
> thread. Any idea of how to do this?
>
> So far I've done this:
>
> void main(const FunctionCallbackInfo<Value>& args) {
> //here goes my main code
>
> //Here I schedule the worker, to run BEFOREmethod in a new thread, and 
> AFTERmethod in the main thread
> uv_queue_work(uv_default_loop(), req, BEFOREmethod,(uv_after_work_cb) 
> AFTERmethod);
>
> return callback;
> }
>
>
>
> void BEFOREmethod(uv_work_t* req){
>
> //here goes the code that runs in new thread
> usleep(200000);
> }
>
>
>
>
> void AFTERmethod(uv_work_t* req, int status){
>
> //here goes the code that runs in main thread
>
> //Then we schedule the uv_queue_work again
> uv_queue_work(uv_default_loop(), req, BEFOREmethod,(uv_after_work_cb) 
> AFTERmethod);
> }
>
> So this works, I can re-schedule the uv_queue_work, but there is a memory 
> leak, if I keep this running, memory usage keeps increasing. But I haven't 
> found another way of doing this. So I would appreciate any help if anybody 
> has an idea.
>
> Thanks in advance!
>
>
> Karim
>

-- 
You received this message because you are subscribed to the Google Groups 
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.

Reply via email to