Problem with cuda global memory

Hi to everyone!

I’m facing a problem in my cuda program:
My program performs a graph isomorphism and i would like to run the matching function with cuda kernel. I’m using a single pattern graph (that should remain the same for all the execution) and several target graphs (that varies at each comparison) .

So i decided to make a single cuda malloc and cuda memcpy that allocate and copies the pattern graph(which is static and never changes), and a new cuda malloc and memcpy for each target graph i’m passing (i know that this is time comsuming but that is not the point).

Everything works fine when the number of target graphs is small,each iteration compares the static pattern graph with the new target graph, but when i pass more target graphs (like 1’000) something strange happens:
execution performs well for several iterations until a cuda error appears (an illegal memory access was encountered(700)). It seems like the static data i copied to device are no longer available. This is confirmed by the fact that if keep reallocating, recopy all of the data and performing a cudaDeviceReset at the end of each iteration, the progam runs without any error. What is going on? Why after several iteration it seems that the static data in global memory disappear?