Invalid memory block

Hi everybody;
I am having a problem with memory block. My code is to capture the migration of particles under the hydraulic load by increasing pressure. When my pressure is slow, particles are stable, the code run smoothly. However, when the particles start to move upward, after running for a while, I will get the error like double free or corruption, corrupted vs prev, munmap_chunk(): invalid pointe****r. I checked on the Internet, and the problem come from that my code access to the invalid memory block. I do not have a coding background. So I am not sure why it accessed to the invalid momery block and how to solve this problem ? I used Palabos coupled with Liggghts.

I searched on the Internet, as I understand, in Palabos, it assumed a memory size, and then it will free the memory. I think my code need more memory size, I am just wondering how to increase the memory size in the source code in Palabos.
Thank you

What do you mean? When particles move out of the domain you have to remove them (add an absorption layer)