Releasing threads resources (OS) after joinThread on windows

2024-03-08 Thread eagledot
Generally i am quite vigilant about what i allocate and what resources i might be using, and define `destructors` accordingly. But in this case i was only using `createThread` and `joinThread` standard routines , i only discovered the issue while benchmarking . I also came across some thread va

Releasing threads resources (OS) after joinThread on windows

2024-03-08 Thread eagledot
Thanks for replying! I know about @mratsim weave and yours Malebolgia. But i work on a BLAS backend in pure nim, and for me it is better to use `createThread` directly even though it would have some `overhead` , this `fork-join` pattern suits well for some of the routines i have implemented. I

Releasing threads resources (OS) after joinThread on windows

2024-03-08 Thread eagledot
@Araq could you please take a look? Some suggestion would be good enough !

Releasing threads resources (OS) after joinThread on windows

2024-03-02 Thread eagledot
For some functionality i was using `fork-join` like pattern and noticed a large gradual spike in Virtual Ram usage. Also i could notice the large number of `handles` in system monitor too. Following code should reproduce the behaviour. It seems to work correctly if i call `closeHandle` on threa