Problem with the associative array with queue (not taking data corrrectly)

In reply to rahulraoece:
Please use code tags making your code easier to read. I have added them for you.

You are pushing the same handle (d2) to the queue, so all queue entries have the same value. You need to move the construction of d2 into the loop.

initial begin 
    mem_h= new();
    d1=new();
    repeat(5)
      begin 
        d2=new();
        assert (d2.randomize());
        mem_h.mem[d1.index].push_back(d2);
        $display("value of q=%p,mem_address =%d",mem_h.mem,mem_h);
      end
  end