Hi :
In below code, Can I say the object classHandle points to( line 10) is destructed when the block2 exits ?
Second question : When an initial block(thread) exits, Is this initial block thread killed ? or exists until to end of simulation.
Thanks
module test;
initial begin : block1
$display(..);
....
begin : block2
classType classHandle = new(); -->line 10
....
end :block2
...
end : block1
endmodule
In below code, Can I say the object classHandle points to( line 10) is destructed when the block2 exits ?
No. It depends on what happens in your “…” ( line 11 ) and in your class constructor. If you do anything there that results in preserving a handle to the object, the object will live on. Also, even if the object is in a state where it could be destroyed, it can hang around until the garbage collector decides it needs to remove it.
Second question : When an initial block(thread) exits, Is this initial block thread killed ? or exists until to end of simulation.
Assuming it wasn’t killed or blocked, it should just finish once the last statement has executed.