String related Segmentation Faults

2021-08-01 Thread Akito
I'm back with good results. First of all, thank you all very much! You really helped a lot. I combined the suggestion given to me, then debugged the crap out of the program and now it runs as it should! Comparing Nim 1.5.1 a.k.a. current development version of Nim to Nim 1.4.8 a.k.a. current s

String related Segmentation Faults

2021-07-27 Thread Araq
Also compile your project with the Nim development version of the compiler which now produces warnings for dangerous implicit conversions to `cstring`.

String related Segmentation Faults

2021-07-27 Thread Akito
Thanks a lot to everyone for these very helpful replies. :) I will investigate all cstring usages extremely carefully and will try to avoid juggling with (c)strings. I'll keep this thread updated. Thank you!!

String related Segmentation Faults

2021-07-27 Thread doofenstein
> Every single segmentation fault is essentially triggered in this exact place: > that sounds a lot like a heap corruption. So it's probably either some code wrtinig more into a cstring than

String related Segmentation Faults

2021-07-27 Thread Akito
I have been trying to find the reason for this issue for days, and can't seem to find it. Perhaps something stupidly easy I am simply missing? I don't know. The problem is, that I am unable to reproduce the error in a small example. I only encounter this problem in a bigger project, that I canno

String related Segmentation Faults

2021-07-27 Thread Stefan_Salewski
I would bet that it is not a Nim problem, but related to your wrong casts or a winnim issue. Try compiling with --gc:arc to see the difference. Then try --gc:arc -d:useMalloc and run it with valgrind. Maybe that gives you more informations.

String related Segmentation Faults

2021-07-27 Thread Clonk
Using `cstring` is an unsafe operation that yields a view of a Nim string. If your string gets deallocated while you hold a `string` view of it you will get a segmentation fault. To proceed from there, review carefully the code using the `cstring`; even if the stacktrace in the segfault doesn't