Looks like at some point `work_t` may be `NULL` in your code. Could you
please add an assertion at this place to verify my assumption?

Cheers,
Fedor.


On Tue, Jul 1, 2014 at 11:44 AM, Ashish <[email protected]> wrote:

>
> I am using libuv in console based application being developed on Windows
> XP
> When my applications memory usage goes high, at certain point (at around
> 2GB) uv_queue_work
> crashes with "runtime error" and sometimes with "R6016- not enough space
> for thread data"
>
>
> This little piece of code demonstrates the same. The code below tries to
> create 321 threads.
> (I am using 321 number for demo purpose but in original code the number is
> just 31)
> 321 is not high number of threads on Windows XP. Still why would it crash:
>
>
> void work_in_thread(uv_work_t* work_t)
> {
>     // Allocate some memory
>     char* memory = new (std::nothrow) char[4321];
>
>     // Simulate some delay
>     Sleep(3);
> }
>
> void after_work_in_thread(uv_work_t* work_t, int status)
> {
>     // Recreate just ended thread (to maintain thread count)
>     int RetVal = uv_queue_work(loop, work_t, work_in_thread,
> after_work_in_thread);
>     if (RetVal != 0) printf("\nERROR recreating thread");
> }
>
> int main()
> {
>     loop = uv_default_loop();
>
>     // Create working threads
>     for (int i=0; i<321; i++)
>     {
>         uv_work_t* work_t;
>         work_t = (uv_work_t*) malloc(sizeof(uv_work_t));
>         int RetVal = uv_queue_work(loop, work_t, work_in_thread,
> after_work_in_thread);
>         if (RetVal != 0) printf("\nERROR creating thread");
>     }
>
>     uv_run(loop, UV_RUN_DEFAULT);
>
>     printf ("\nCame out of loop...");
>
>     return 0;
> }
>
>  --
> 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.
>

-- 
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