Reducing array.length triggers reallocation
Ivan Kazmenko via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Dec 27 16:12:36 PST 2015
On Sunday, 27 December 2015 at 22:36:32 UTC, Ali Çehreli wrote:
> [Several hours later...]
>
> You know what... I bet there is no actual allocation at all. I
> think what happens is, the code calls GC.realloc(24) and
> realloc() does not do anything. However, it still reports to
> the profiler that there was an allocation (attempt).
>
> Can someone verify that please. At least, can someone show
> where GC.realloc() source is.
>
> Thank you,
> Ali
I believe it boils down to calling gc.gc.reallocNoSync in
druntime:
https://github.com/D-Programming-Language/druntime/blob/master/src/gc/gc.d#L603 .
More information about the Digitalmars-d-learn
mailing list