this pointer incremented in .cu code

I have a .cu file that creates an instance of a class which is implmented in a different .cu file. Here is a very simplified version. My code is much larger, but if this is not enough, I can include it. The issue is that once I get into the implementation of my class, the “this” pointer increments with every line of code executed.

//initializer.cu

MyClass initialize(int i)

{

    MyClass m(i);

    return m;

}
//MyClass.h

public class MyClass

{

    int var;

    int* myarray;

public:

MyClass(int i);

}
//MyClass.cu

__global__ void g_myfunc(int* array, int val)

{

    //some code

}

MyClass::MyClass(int i)

{

   var = i;

   myarray = 0; //this pointer increments

   cudaMalloc((void**)&myarray,1000 * sizeof(int)); //this pointer increments

//this pointer is off and myarray and val are incorrect values

   g_myfunc<<<1,1>>>(myarray, val);

}

This used to not occur in my code and I have done very similar things in other projects and not encountered this error. Is there a way to stop this, or am I doing something wrong?

Thanks

This was actually an error with the debugger in Visual Studio 2008. The actually value of “this” stayed the same.