spiridonov commented on PR #645:
URL: https://github.com/apache/arrow-go/pull/645#issuecomment-3780975070

   That is a great question! I also was confused in the beginning, because I 
saw those objects being allocated in a memory profile report. I did some 
research and I think that it happens _sometimes_ because the compiler is 
conservative. If it is not 100% sure in the result of escape analysis (the 
value is indeed passed into another func that passes it into another func) or a 
structure is too large it falls back to allocate it on the heap instead of 
stack. I did build a sandbox example https://godbolt.org/z/h19PnWM7T which 
shows `runtime.newobject` clearly. Compare that with a simpler type 
https://godbolt.org/z/KMznfPxMx which does not allocate on the heap.


-- 
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