A possible implementation could be done purely at the byte code level. Store a private property on the object that was just allocated which contains whatever meta information you want. It could be a backtrace. It could be a code location.
Maybe we could even just limit it to larger (for some clarification of what that means) allocations so it could be almost(?) always-on?
(In reply to comment #1) > Maybe we could even just limit it to larger (for some clarification of what > that means) allocations so it could be almost(?) always-on? I'm not sure how you could easily do such a thing easily. Object size grows as the object lives longer. I guess you could have some kind of a system that starts by profiling everything and then backs off slowly to only profile some things as it figures out the tendency of the program's allocations. That seems hard and I'm not even sure it would work. Were you thinking of a particular mechanism when you suggested this?
<rdar://problem/25994092>