Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. COGarbage collection? Nothing is allocated on the heap in either case here. Passing a reference to an already allocated object doesn't involve any GC work. In any case, these are parameters, they are on the stack, so the GC isn't involved in allocating/deallocating those items. Taking up a few extra bytes on the stack is pretty tiny, and will have no runtime speed implications.
      singulars
    2. COAs I said, any difference will be negligible. It's not necessarily true at all that passing a reference to a heap object doesn't involve GC work. The GC has to track/count references. Nor is it true that a few extra bytes on the stack has no runtime speed implications - try passing a large data structure on the stack to highly recursive method. The data structure size not only makes a speed difference but could take you over the stack allocation limit.
      singulars
    3. CONo, the GC does *not* track/count references; that's not how it works. Perhaps you should spend a bit of time reading up on the .NET GC. As for stack allocations, "allocating" more space on the stack is simply incrementing a pointer (the stack pointer). Incrementing it by 4 words is no more or less expensive than incrementing it by 2 words. Likewise de-allocating the memory from the stack has no more or less cost, decrimenting the stack pointer by 4 words has the same cost as decrimenting it by 2 words. The time would only differ in what it takes to copy *useful* data, not in allocating.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload