I have been using the CadMesh library to import some CAD models of some samples for particle scattering simulations.
Some of the samples work with no problems, I managed to shoot particles from different incidence angles (1deg - 89deg) and they have so far worked great.
Modifying the code to use for the other samples involved simply swapping out the input CAD model using one line of code, and rebuilding the new project in a new directory. Following the logic that the experimental set up is the same, using the same code for the other samples should give equivalent results.
Despite this working fine for 3 different samples, some of the other samples returned a memory allocation error as the full sample was loaded. The full sample is about 120 Mb.
exampleB1: malloc.c:2379: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
I then tried to address this problem in different ways, I first allocated 64gb of memory from the cluster for the run, which should have been way more than needed, but this ended with the same result. We tried to use valgrind to look for memory leaks (log is on this link). We recompiled Geant4 with the -DCMAKE_BUILD_TYPE=RelWithDebInfo flag to get some more debug info.
I then tried to bin the problem samples, whereby some of the problem samples worked fine, and some of them returned a new memory allocation error.
Binned sample error:
malloc(): invalid next size (unsorted)
Meanwhile, a colleague ran the same code on his laptop with 32gb of ram and got no error at all.
While reading stackoverflow and posts from others whom have had this similar issue, someone mentioned that this problem could be coming from bad headers, but I don’t think this is possible here.
Would anyone have any idea of what I can do to address this? My next idea is to manually break the samples into smaller regions to try to determine if this is a problem with the measurement itself, although this seems unlikely as well because the output is just a simple matrix.
Thank you for your time!