candiduslynx commented on code in PR #35973:
URL: https://github.com/apache/arrow/pull/35973#discussion_r1223209998


##########
go/arrow/memory/checked_allocator.go:
##########
@@ -160,14 +160,35 @@ func (a *CheckedAllocator) AssertSize(t TestingT, sz int) 
{
                                break
                        }
                        callersMsg.WriteString("\t")
-                       callersMsg.WriteString(frame.Function)
-                       callersMsg.WriteString(fmt.Sprintf(" line %d", 
frame.Line))
+                       // frame.Func is a useful source of information if it's 
present.
+                       // It may be nil for non-Go code or fully inlined 
functions.
+                       if fn := frame.Func; fn != nil {
+                               // format as func name + the offset in bytes 
from func entrypoint
+                               callersMsg.WriteString(fmt.Sprintf("%s+%x", 
fn.Name(), frame.PC-fn.Entry()))
+                       } else {
+                               // fallback to outer func name + file line
+                               callersMsg.WriteString(fmt.Sprintf("%s, line 
%d", frame.Function, frame.Line))
+                       }
+
+                       // Write a proper file name + line, so it's really easy 
to find the leak
+                       callersMsg.WriteString("\n\t\t")
+                       callersMsg.WriteString(frame.File + ":" + 
strconv.Itoa(frame.Line))
                        callersMsg.WriteString("\n")
                        if !more {
                                break
                        }
                }
-               t.Errorf("LEAK of %d bytes FROM %s line %d\n%v", info.sz, 
f.Name(), info.line, callersMsg.String())
+
+               file, line := f.FileLine(info.pc)
+               t.Errorf(`LEAK of %d bytes FROM
+       %s+%x

Review Comment:
   ```suggestion
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to