I found a work around but the problem I guess is in loading the module.
I got the above error when loaded the module to a pointer like this in an init function of a class instance.
auto *module = new torch::jit::script::Module;
*module = torch::jit::load(fileName);

module is cast to void pointer and kept as a member variable of the class. I got the error in a class’ method call. I recast the void pointer to torch::jit::script::Module but some arrays are violated in this way I guess.
The work around is to use the conventional way
module = torch::jit::load(fileName);
What is your suggestion to keep a valid module pointer in a class member?