diff --git a/ARMeilleure/Common/EntryTable.cs b/ARMeilleure/Common/EntryTable.cs
index bb171dc67c..5f5a0e8473 100644
--- a/ARMeilleure/Common/EntryTable.cs
+++ b/ARMeilleure/Common/EntryTable.cs
@@ -10,13 +10,13 @@ namespace ARMeilleure.Common
/// address through out the table's lifetime.
///
/// Type of the entry in the table
- class EntryTable : IDisposable where TEntry : unmanaged
+ class EntryTable where TEntry : unmanaged
{
private bool _disposed;
private int _freeHint;
private readonly int _pageCapacity; // Number of entries per page.
private readonly int _pageLogCapacity;
- private readonly Dictionary _pages;
+ private readonly Dictionary _pages;
private readonly BitMap _allocated;
///
@@ -41,7 +41,7 @@ namespace ARMeilleure.Common
}
_allocated = new BitMap();
- _pages = new Dictionary();
+ _pages = new Dictionary();
_pageLogCapacity = BitOperations.Log2((uint)(pageSize / sizeof(TEntry)));
_pageCapacity = 1 << _pageLogCapacity;
}
@@ -149,49 +149,14 @@ namespace ARMeilleure.Common
{
var pageIndex = (int)((uint)(index & ~(_pageCapacity - 1)) >> _pageLogCapacity);
- if (!_pages.TryGetValue(pageIndex, out IntPtr page))
+ if (!_pages.TryGetValue(pageIndex, out TEntry[] page))
{
- page = Marshal.AllocHGlobal(sizeof(TEntry) * _pageCapacity);
+ page = GC.AllocateUninitializedArray(_pageCapacity, pinned: true);
_pages.Add(pageIndex, page);
}
- return new Span((void*)page, _pageCapacity);
- }
-
- ///
- /// Releases all resources used by the instance.
- ///
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- ///
- /// Releases all unmanaged and optionally managed resources used by the
- /// instance.
- ///
- /// to dispose managed resources also; otherwise just unmanaged resouces
- protected virtual void Dispose(bool disposing)
- {
- if (!_disposed)
- {
- foreach (var page in _pages.Values)
- {
- Marshal.FreeHGlobal(page);
- }
-
- _disposed = true;
- }
- }
-
- ///
- /// Frees resources used by the instance.
- ///
- ~EntryTable()
- {
- Dispose(false);
+ return page;
}
}
}
diff --git a/ARMeilleure/Translation/Translator.cs b/ARMeilleure/Translation/Translator.cs
index 9f88f17a9b..db800918d4 100644
--- a/ARMeilleure/Translation/Translator.cs
+++ b/ARMeilleure/Translation/Translator.cs
@@ -174,8 +174,6 @@ namespace ARMeilleure.Translation
_jumpTable.Dispose();
_jumpTable = null;
- CountTable.Dispose();
-
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
}
}