示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void trackPrimitiveMemoryAllocations()
        internal virtual void TrackPrimitiveMemoryAllocations()
        {
            LocalMemoryTracker memoryTracker = new LocalMemoryTracker();
            PrimitiveIntSet    offHeapIntSet = Primitive.OffHeapIntSet(memoryTracker);

            assertTrue(memoryTracker.UsedDirectMemory() > 0);

            offHeapIntSet.Close();
            assertEquals(0, memoryTracker.UsedDirectMemory());
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void trackPrimitiveMemoryOnResize()
        internal virtual void TrackPrimitiveMemoryOnResize()
        {
            LocalMemoryTracker memoryTracker = new LocalMemoryTracker();
            PrimitiveIntSet    offHeapIntSet = Primitive.OffHeapIntSet(memoryTracker);
            long originalSetMemory           = memoryTracker.UsedDirectMemory();

            for (int i = 0; i < Primitive.DefaultOffheapCapacity + 1; i++)
            {
                offHeapIntSet.Add(i);
            }

            assertTrue(memoryTracker.UsedDirectMemory() > originalSetMemory);

            offHeapIntSet.Close();
            assertEquals(0, memoryTracker.UsedDirectMemory());
        }