Did you add the missing #include statements?
This is what I am trying to figure out, as this does not happen when I try to run a smaller file, e.g. of 20 MB.
2 ways to go further. One is to add print statement to figure out ‘where’ and ‘when’ the pointer turn to a nullptr. The other is to fix the compilation error and use valgrind to pin point the memory error (if any).