Hi,
I'm sorry for not getting back to you sooner. I missed your email earlier.
The problem is this line:
proot->pqueue=new Persistentqueue();
You are creating a new instance of Peristentqueue on DRAM, but later, you call
pmem::obj::pool_by_vptr on that instance. This will not work since that function expects a pointer to an object that resides on PMEM. The solution to this problem is just to remove this line. You've already created an instance of Persistenqueue by calling make_persistent_atomic.
In fact, all make_persistent* functions do two things: allocate memory on PMEM and call the appropriate constructor (based on the template parameter). When you reopen the pool, you don't need to call the constructor for the second time - you use the same instance. You should be aware that this programming model does not fully adhere to the C++ standard. You can read about limitations here:
https://github.com/pmem/libpmemobj-cpp/tree/master/include/libpmemobj%2B%2B#c-standard-notice and here:
https://pmem.io/blog/2019/10/c-standard-limitations-and-persistent-memory/.
Best regards,
Igor