[Scummvm-git-logs] scummvm master -> 53d0fe22d902efa196ae1da03245d56f543c0ae2

criezy criezy at scummvm.org
Mon Jul 30 20:34:33 CEST 2018


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
53d0fe22d9 COMMON: Fix HashMap never reusing erased items storage


Commit: 53d0fe22d902efa196ae1da03245d56f543c0ae2
    https://github.com/scummvm/scummvm/commit/53d0fe22d902efa196ae1da03245d56f543c0ae2
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2018-07-30T19:32:02+01:00

Commit Message:
COMMON: Fix HashMap never reusing erased items storage

When erasing and inserting many items this caused the hashmap capacity
to grow more than it should which resulted in performances issues (and
possibly memory issues as well). The issue was reported on IRC today
with the wintermute engine.

Changed paths:
    common/hashmap.h


diff --git a/common/hashmap.h b/common/hashmap.h
index 1f93b68..7913d8f 100644
--- a/common/hashmap.h
+++ b/common/hashmap.h
@@ -507,7 +507,7 @@ typename HashMap<Key, Val, HashFunc, EqualFunc>::size_type HashMap<Key, Val, Has
 #ifdef DEBUG_HASH_COLLISIONS
 			_dummyHits++;
 #endif
-			if (first_free != _mask + 1)
+			if (first_free == NONE_FOUND)
 				first_free = ctr;
 		} else if (_equal(_storage[ctr]->_key, key)) {
 			found = true;
@@ -528,7 +528,7 @@ typename HashMap<Key, Val, HashFunc, EqualFunc>::size_type HashMap<Key, Val, Has
 		(const void *)this, _mask + 1, _size);
 #endif
 
-	if (!found && first_free != _mask + 1)
+	if (!found && first_free != NONE_FOUND)
 		ctr = first_free;
 
 	if (!found) {





More information about the Scummvm-git-logs mailing list