Closed widon1104 closed 4 years ago
Hi @widon1104,
I think it's really dangerous If the variable address change beacuse the address may be store in a pointer, if the variable address change use "*" to get the value, the app will crash.
If that happens, the variable will escape to heap, and not be stack allocated anymore. And pointer checks will succeed.
Feel free to go through this thread here: https://twitter.com/empijei/status/1206718810025267200
Unlike other projects, we do not use the issue tracker for questions such as these. It is only used for bugs and feature proposals. I will close this issue, but please feel free to ask it in any of these forums below:
Stack Overflow with questions tagged "go"
The Go Forum, a web-based forum
Gophers Slack, use the invite app for access. The #general
channel is a good starting point.
Go Community on Hashnode with questions and posts tagged with "go"
IRC channel #go-nuts on Freenode
Thanks
I think it's really dangerous If the variable address change beacuse the address may be store in a pointer, *if the variable address change use "" to get the value, the app will crash.**
This cannot happen. Go is a memory safe language. After the stack is copied to the new location, pointers local to the function are updated by the runtime.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I just want to ask a question, I read a golang book, the book says when the stack of a go routine expand the variable's address in stack may change. That's ready shock me. I don't know weather this statement right or wrong, if a variable allocated in stack then the stack expand and allocate stack space in another place the variable address in stack will change ? I think it's really dangerous If the variable address change beacuse the address may be store in a pointer, if the variable address change use "*" to get the value, the app will crash.
What did you expect to see?
What did you see instead?