summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/emualloc.h
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2011-04-19 15:08:42 +0000
committer Aaron Giles <aaron@aarongiles.com>2011-04-19 15:08:42 +0000
commita0647e8e68a6c73b40134953c7a721b01772ffda (patch)
treefa5d583a44328a4baf28f0cd8cde2d74a5ef897f /src/emu/emualloc.h
parentd3a15604330c256897f226a0e69b5c1627362a9b (diff)
Use much bigger hash tables for memory allocations now that we aremame0142u1
allocating lots of small objects. Previous size was scaling poorly and taking a lot of time to free, causing things like -listxml and -validate to be a lot slower than before since the new driver_enumerator actually frees all of its memory at the end. Also changed resource_pool to support a hash table size as input to the constructor, which allows the global pool to be large, while the machine-local pools can remain smaller.
Diffstat (limited to 'src/emu/emualloc.h')
-rw-r--r--src/emu/emualloc.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/emu/emualloc.h b/src/emu/emualloc.h
index e4da24c52a5..e2abb7a271f 100644
--- a/src/emu/emualloc.h
+++ b/src/emu/emualloc.h
@@ -277,7 +277,7 @@ private:
resource_pool &operator=(const resource_pool &);
public:
- resource_pool();
+ resource_pool(int hash_size = 193);
~resource_pool();
void add(resource_pool_item &item);
@@ -292,10 +292,9 @@ public:
template<class T> T *add_array(T* array, int count) { add(*EMUALLOC_SELF_NEW resource_pool_array<T>(array, count)); return array; }
private:
- static const int k_hash_prime = 193;
-
+ int m_hash_size;
osd_lock * m_listlock;
- resource_pool_item * m_hash[k_hash_prime];
+ resource_pool_item ** m_hash;
resource_pool_item * m_ordered_head;
resource_pool_item * m_ordered_tail;
};