Re: [go-nuts] Does gc hate me?

2019-02-26 Thread yangwuist
Yes, the problem is solved with the help of Tamás Gulácsi , and I'm trying to dig out the reason of my mistake there. Thank you all! On Tuesday, February 26, 2019 at 1:40:40 PM UTC+8, Jan Mercl wrote: > > > On Tue, Feb 26, 20

Re: [go-nuts] Memory corruption with GOGC=on

2019-02-25 Thread yangwuist
Sorry for taking a while to reply and, thank you very much!!! After testing over and over again this morning, the errors are gone, including the bad errors in Does gc hate me? What I got in the stacktrace is only about gc and run

[go-nuts] Does gc hate me?

2019-02-25 Thread yangwuist
Hi all, The following unexpected fault address errors are occured occasionally. All of them is gcStart relavent, and it works fine when I turn gc off. Feel frustrated and become addicted to runtime.KeepAlive() XD. Please give some clues, thank you! *1. Make slice* code pReceive := make([]cont

Re: [go-nuts] Memory corruption with GOGC=on

2019-02-25 Thread yangwuist
I'm sorry for the missed detail of Receive() function. Variable gReceive (sorry for the silly variable name) will be manipulated in Go, since some data coversions in the latter loop. Function Receive(): func Receive( devType int, devIndex int, canIndex int, pReceive []CanObj, waitTime int, ) (c

Re: [go-nuts] Memory corruption with GOGC=on

2019-02-25 Thread yangwuist
Thank you! There is a pointer copied between Go and Cgo indeed, i.e., Go creates a slice (pReceive) to Cgo, which reads data into it. It would be reasonable when there are some panics occurred there. Actually, what triggers the panic is the make-slice statements, i.e., cReceive := make([]C.str

[go-nuts] Memory corruption with GOGC=on

2019-02-24 Thread yangwuist
HI all, Error unexpected fault address might be triggered by data race or memory corruption. After code review, I suspected the reasin is memory corruption instead of the data race. The following code panics occasionally, and yes, when I initialized silces. package controlcan import "C" cRec