www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Segmentation Fault on rt.tlsgc.init

reply tcak <1ltkrs+3wyh1ow7kzn1k sharklasers.com> writes:
If I create many threads (starts, does a short work, and ends) 
repeatedly (>10,000), at some point rt.tlsgc.init() gives 
SEGMENTATION_FAULT.

It doesn't check whether malloc fails to allocate any memory, and 
I cannot find the source code of "rt.sections.initTLSRanges()" 
anywhere.

Is it left there without a check purposefully?
Apr 05 2016
parent Jacob Carlborg <doob me.com> writes:
On 2016-04-05 11:46, tcak wrote:
 If I create many threads (starts, does a short work, and ends)
 repeatedly (>10,000), at some point rt.tlsgc.init() gives
 SEGMENTATION_FAULT.

 It doesn't check whether malloc fails to allocate any memory, and I
 cannot find the source code of "rt.sections.initTLSRanges()" anywhere.

 Is it left there without a check purposefully?
rt.sections.initTLSRanges is available here for Linux and FreeBSD [1]. For other platforms there are similar files. https://github.com/D-Programming-Language/druntime/blob/master/src/rt/sections_elf_shared.d#L145 -- /Jacob Carlborg
Apr 05 2016