-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go开辟空间给c用会内存泄露吗 #8
Comments
要分场景。如果是Go的切片内容传人C函数临时使用,C函数返回前是安全的。如果C函数返回后被其它C函数引用,那么因为GC可能导致Go内存被移动,因此这种C函数的引用是错误的。如果是调用C函数的malloc,那么就是传统C语言管理内存的模式。 |
如果 c函数返回 拷贝一份,还可以继续传入下个c函数用吗? @chai2010 |
如果是C语言分配的内存空间,任何时刻都可以再传给C函数使用 |
有可能被 go 给gc掉吗? |
C分配的内存,gc不会释放。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: