Segmentation fault in DMD - how to debug?

Steven Schveighoffer schveiguy at gmail.com
Mon Oct 3 14:45:50 UTC 2022


On 10/2/22 5:12 PM, Walter Bright wrote:
> On 9/29/2022 7:50 AM, Steven Schveighoffer wrote:
>> Classic problem for memory allocation is nobody checks if it succeeds, 
>> or if they do, they don't handle it properly. This likely includes 
>> various places in the compiler.
> 
> If you can find one, I owe you a beer for the next BeerConf.
> 
> 

haha, now I need to go look for one!

In all seriousness though, I've definitely had 4 types of results when 
DMD runs out of memory:

1. OOM Killer kills the process (this is the most frequent on Linux)
2. Segfault
3. Seemingly random assert error or other exception.
4. Out of memory notification (this is what should always happen, except 
for OOM killer)

Not saying any of this is proof the compiler (or used library) 
incorrectly ignores a failed memory allocation, but it would fit the 
pattern.

-Steve


More information about the Digitalmars-d mailing list