CUDA memory management : new delete free

Tesla c2075 ,CUDA 6.5,CC 2.0

I using OOP approach to CUDA . I am creating objects using new operators , classes , functions , inheritance etc…

My problem is that my program is failing after few iterations , with cuda debugger i see followng problem with memory —> problem with DELETE operator

Memory Checker detected 288 access violations.
error =
gridid = 39
blockIdx = {0,2,0}
threadIdx = {96,0,0}
address = 0x500a5fa60
accessSize = 0
First I have kernel :

extern "C" __global__  void Simulate()
{
   GetIntersectionsFromList()    
}

and device function :

__device__    void GetIntersectionsFromList()
{
   LinkedItem<GeometryObject> *aGeomObject = Geometries.getFirstItem();
   GeometryObject* obj = aGeomObject->Item ; 
   Vector3D* outPoints = obj->intersect(r_in);        
   Intersection* ints = new Intersection()
   ints->Add(outPoints);
   delete obj; 
}

where Geometries is list defined as

LinkedList<GeometryObject> Geometries =  LinkedList<GeometryObject>();

and LinkedItem is defined as :

Template<typename T> class LinkedItem
   {
     public:
        T   *Item;
        LinkedItem<T> *NextItem;

     public:
        __device__ LinkedItem()
            {
            }

    __device__ LinkedItem (T *item_in)
    {
        Item = item_in;
        NextItem = NULL;
    }
  };

my problem is …

delete obj;
On Warps Info Page I have : ! Exception InvalidFree

obj is not null , obj has normal values , obj is accesible but delete is problem , when i am debugging. So I think that it should be problem why my application fails after few runs …some memory issue

ALSO :

the problem is only with objcets created inside while loop …strange… and free(…)

{
LinkedItem<GeometryObject> *aGeomObject = Geometries.getFirstItem();

while (aGeomObject != NULL)
{

GeometryObject* obj = aGeomObject->Item; 
            Vector3D* outPoints = obj->intersect(r_in);

            if (isnan(outPoints[0].x))
            {
            }
            else 
            {
              Intersection* ints = new Intersection();
                ints->setOrigin(&outPoints[0]);
                ints->setDirection(&outPoints[1]);
                ints->setMaterial( obj->getMaterial());                         

                       delete ints;     
            }
      aGeomObject = Geometries.getNextItem(aGeomObject);
    free(outPoints); // doesnt WORK 
        free(obj);  // deosnt WORK
    }

 free(aGeomObject);// WORKS

}

problem should be with objects I am creating from my linkedlists or with objects pointer which are not directly created using new …

cross posted here:

[url]http://stackoverflow.com/questions/29963747/cuda-delete-operator-memory-checker-detected-288-access-violations[/url]

yes but I hope here I will have more comfortable answer …

just had the debugger abort and break on a free, without a malloc, only after the 6th iteration, with MALLOC_CHECK_ set to 2

so, go figure…

i had the array pointer in a structure; the array became redundant; i removed the malloc, but forgot to remove the free, and the pointer entry in the structure

somewhere, something somehow forgot about this until the 6th iteration

skittish