Hi guys, I have a problem when running programs on Optane DCPMM, please help check the following code:

The error is when the loop iterates at the 65478th iteration, the pmem_file_map function returns NULL. The mapped_len and is_pmem for this iteration keep value at 0. The error number is 12, which means cannot allocate memory or out of memory. However, I check the space left on the persistent memory, there is still plenty of space available (still remains 300GB). I am not sure why it reports cannot allocate memory.
When I remove the comment on line 27 ( pmem_unmap(addr, sizeof(Mystruct)); ), the program can finish running successfully. I guess there is something wrong here for function pmem_map_file. I don't know why it behaves this way. Many thanks for the help if you guys have any ideas for this question.