In reply to naveensv:
I’m not sure how you’re printing. I used:
$display("%p", legal_nexts);
and it worked fine for me, but I was using a small number for the array size.
W.r.t. not freeing up in post_randomize(), it depends on how big your arrays are. You’re going to be allocating a lot of memory during randomization that’s just going to get wasted afterwards. If you anyway throw away the object after randomization or only create a few objects of that class, you shouldn’t see any big improvement. The only way to say for sure if it noticeably affects performance is to do a profiler run.