Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/cgo: panic if C.CString can't allocate memory #3403
Not sure about this. C.malloc is an ordinary function, so it's hard to make that one panic. It's difficult to see why C.CString should be different. FWIW, you're on Linux so it will never happen anyway.
Labels changed: added priority-later, removed priority-triage.
Status changed to Thinking.
The definition of Cmalloc, http://code.google.com/p/go/source/browse/src/cmd/cgo/out.go?spec=svn46fd4ef6c0deeb184aa0b843dfc080cc869a7e19&name=46fd4ef6c0de&r=46fd4ef6c0deeb184aa0b843dfc080cc869a7e19#1226 assumes a NULL return from malloc() means it's out of memory, but NULL is a valid return for malloc(0). Perhaps Cmalloc will never be called for zero bytes of memory and this isn't an issue, but I thought it worth checking. If Cmalloc(0) isn't possible, a comment to that affect would stop future readers wondering.