@ Override public void purgeDeviceObject ( Long threadId , Integer deviceId , Long objectId , AllocationPoint point , boolean copyback ) { if ( point . getAllocationStatus ( ) != AllocationStatus . DEVICE ) return ; flowController . waitTillReleased ( point ) ; free ( point , AllocationStatus . DEVICE ) ; if ( ! deviceAllocations . get ( deviceId ) . containsKey ( objectId ) ) throw new IllegalStateException ( "Can't happen ever" ) ; forget ( point , AllocationStatus . DEVICE ) ; if ( deviceAllocations . get ( deviceId ) . containsKey ( objectId ) ) throw new IllegalStateException ( "Can't happen ever" ) ; deviceMemoryTracker . subFromAllocation ( threadId , deviceId , AllocationUtils . getRequiredMemory ( point . getShape ( ) ) ) ; point . setAllocationStatus ( AllocationStatus . HOST ) ; //environment.trackAllocatedMemory(deviceId, AllocationUtils.getRequiredMemory(point.getShape())); }
This method explicitly removes object from device memory .