How to detect if an array if dynamic or static

Chris Wright via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Feb 25 08:18:31 PST 2016


On Thu, 25 Feb 2016 02:08:18 +0000, Adam D. Ruppe wrote:

> On Thursday, 25 February 2016 at 01:31:17 UTC, Chris Wright wrote:
>> When you get to GC-allocated stuff, there's no way to tell.
> 
> The GC is easy, you can simply ask it:
> 
> http://dpldocs.info/experimental-docs/core.memory.GC.addrOf.1.html

I saw that method, and I saw that it returned the base address of a Pool. 
>From the name, fields, and Gcx invocation, I guessed that Pool 
represented a bundle of multiple values. It's got about ten or twelve 
words of overhead, which would be a bit heavy to have one for each 
allocated object. (And that's on top of the bookkeeping malloc has to do, 
since the GC uses malloc under the hood.)

Or maybe it's just got that much overhead.


More information about the Digitalmars-d-learn mailing list