I'll try first the first tip of Adam, here the code,

```
import std.stdio:writeln;
import core.memory: GC;
void myfun(){
class C{
        int[10000] x;
        }//class C
        
struct S {
        C c=null;
        @disable this();

        this(int dummy) {
                c=new C();
                writeln("Constructor");
                };//Constructor

        ~this(){
                writeln("Destructor");
                .destroy(c);
                void * address=GC.addrOf(cast(void *)c);
                GC.free(address);
                };//destructor
}//struct S
S mys=S(0);
};//myfun()

void main(){
        myfun();
};//main
```

Reply via email to