NVMEX file crashes on second execution

I’ve compiled an NVMEX file that is basically a combination of four standalone NVMEX files that I previously compiled and tested. The .cu file compiles successfully. The issue I’m having that is when I invoke the NVMEX function (let’s call it test_me), it executes the first time absolutely perfectly, but if I call the function a second time, sending it the exact same data set, Matlab immediately closes without showing any errors or otherwise useful debug information. Here’s the other oddity with this: if I call test_me, and then in the Matlab command line issue “clear test_me”, I can then call test_me again without Matlab crashing. Clearly I’m messing up something, but I’m not sure where to start looking. I’m used to debugging memory errors that fail on the first pass; this has me puzzled since it runs once correctly before puking on itself. Any thoughts? Following is the pseudo-code for Matlab:

[a] = test_me[b]; %executes properly
[a] = test_me[b]; %crashes Matlab without any errors or warnings

[a] = test_me[b]; %executes properly
clear test_me
[a] = test_me[b]; %executes properly

The four separate kernels that make up this .cu file have been previously compiled individually and executed repeatedly; they simply do not have the same crashing behavior (fortunately). I’d upload me code, but it’s ~900 lines; a bit beyond what anyone wants to wade through. Any suggestions would be appreciated.