### Question:
CudaFullCachingProvider extends CudaCachingZeroProvider { @Override public synchronized void purgeCache() { for (Integer device : deviceCache.keySet()) { for (AllocationShape shape : deviceCache.get(device).keySet()) { Pointer ptr = null; while ((ptr = deviceCache.get(device).get(shape).poll()) != null) { freeDevice(ptr, device); } } deviceCachedAmount.get(device).set(0); } super.purgeCache(); } CudaFullCachingProvider(); void init(); @Override PointersPair malloc(AllocationShape shape, AllocationPoint point, AllocationStatus location); @Override void free(AllocationPoint point); @Override synchronized void purgeCache();  }### Answer:
@Test public void testPurge1() throws Exception { for (int x = 0; x < 10000; x++) { INDArray array = Nd4j.create(10,10); } INDArray array = Nd4j.create(10,10); AllocationShape shape = AtomicAllocator.getInstance().getAllocationPoint(array).getShape(); System.gc(); System.gc(); Thread.sleep(1000); CudaFullCachingProvider provider = (CudaFullCachingProvider) AtomicAllocator.getInstance().getMemoryHandler().getMemoryProvider(); log.info("Shapes in cache: {}", provider.deviceCache.get(0).get(shape).size()); assertTrue(provider.deviceCache.get(0).get(shape).size() > 0); provider.purgeCache(); assertTrue(provider.deviceCache.get(0).get(shape).size() == 0); }