Open NHDaly opened 1 year ago
I'm not sure what the other 8 missing allocations are yet. ~This was the most obvious one, since there's around 2.00 KiB unaccounted for.~
EDIT: Oh wait, duh, nvm, the existing allocations already sum to 1.480 KiB
, so the stack allocation isn't currently being reported in @time
, either! 💡
CC: @gbaraldi, @IanButterworth
EDIT: Oh wait, duh, nvm, the existing allocations already sum to 1.480 KiB
, so the stack allocation isn't currently being reported in @time
, either! 💡
K, i updated the description per my new understanding.
We might not want to report the stack allocation anyway, it's kind of a deep internals thing that might make a user go crazy. I do wonder where the other allocations are coming from. I guess an rr trace to see when the allocation counter goes up but we don't record the allocation.
Yeah, i'm not sure either.. I think that it might be useful though, since it is ultimately part of the user's program, and it's something that they have control over. E.g. if you find you're unexpectedly spawning like 10,000,000 tasks or something, and it's your main contributor to allocations?
But i can see the argument not to report them as well...
I guess an rr trace to see when the allocation counter goes up but we don't record the allocation.
Great idea, yeah! :) I don't think we have the cycles to push on this now, but i'll leave this idea here for the future, or for if you or anyone there has the cycles+interest to hunt these down. Thanks! 😊
If it was solely up to me, i think i'd lean towards reporting the allocations of the Task stacks as well.
I'd also be interested to check to see what Golang's allocations profiler does, and whether or not they report them.
CC: @vilterp as well
The task stack is anonymous memory, we ask the OS for 4MiB but the actually allocation does not happen. So this is potential memory use not actual memory use. The cost of memory will be incurred when the stack actually grows to that size.
So I don't think we should report it as part of @time
💡 oh cool, thanks! I didn't know that. That's nifty. Okay yeah i think that sounds reasonable then. 👍
thanks! Should I repurpose this issue for the remaining 9 other missing allocs, or close it and open a new one?
I'm curious if this is related to #50187
🤔 it doesn't look like it's exactly the same, since no tasks involved, but agreed that it's the same symptom... Yeah, maybe they're related! 💡 Thanks @charleskawczynski. I commented on the other thread too 👍
There are 9 objects being allocated when allocating a Julia Task that are missed by the Allocation Profiler (https://github.com/JuliaLang/julia/pull/42768).
Additionally, both the Allocation Profiler and
@time
are missing the allocation of the stack for a Julia Task.You can see in the following example, that we are actually missing around 9 allocations, ~including the allocation of the Task stack,~ but they are tracked by
@time
:I think the stack allocation happens here, but i'm not 100% sure: https://github.com/JuliaLang/julia/blob/b7201d6b460df74f024a6f19f837437a2c0613d1/src/gc-stacks.c#L150-L182
or maybe this is a better place to instrument - this is the actual site of the
mmap
: https://github.com/JuliaLang/julia/blob/b7201d6b460df74f024a6f19f837437a2c0613d1/src/gc-stacks.c#L53-L67~Where does this get tracked and added to the allocs reported in
@time
?~EDIT: I believe that the stack allocation is also not being captured by
@time
, since I think they're more like 4MiB, and I don't see any accounting for the allocation in the above code.