Questions about GC

Thomas vigipe3501 at preparmy.com
Mon Jun 22 23:37:56 UTC 2026


Hi, just a couple of questions about how the GC works

1.

if you have an array that doesnt have any pointers like

```
struct Point { double x,y;}

Point[] points;
```

Does the GC still go through and scan them for pointers or does 
the compiler know that it doesn't have to?


2.

if you have an array with a local scope

```
while(something)
{
    int[] xs;

    // do something

}  <-- does it return the memory here for 'xs' for reuse 
instantly since it knows it's unreachable or does it wait for a 
collection event?
```



More information about the Digitalmars-d-learn mailing list