From 3893cb63e034180eab0764ee18567a56e8307a80 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 31 Dec 2008 02:33:43 +0000 Subject: Wow, that was a freaky bug. Turned out to not have anything to do with the size of the table, it had to do with using non pointer types for the key (some more complex types worked as well, probably because of lazy memory collection) and then using the [] indexing operators. You wound up with pointers to local variables that didn't exist by the end of the assignemnt operator. Strange, but I didn't actually use references inside of all of the Bu::Hash accessor functions, that means in cases where more complex variables are used as keys (like Bu::FString) it was making several copies of them per operation and destroying them all immediately. Now it will be even faster and use much less memory. Good catch, David. --- src/unit/hash.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/unit/hash.cpp') diff --git a/src/unit/hash.cpp b/src/unit/hash.cpp index 1c873fd..e04a656 100644 --- a/src/unit/hash.cpp +++ b/src/unit/hash.cpp @@ -94,11 +94,11 @@ public: unitFailed("h.get(\"Number 2\") should have thrown an exception."); } catch( Bu::HashException &e ) { } - printf("\n"); + /* printf("\n"); for( StrIntHash::iterator i = h.begin(); i != h.end(); i++ ) { printf(" - \"%s\" = %d\n", i.getKey().getStr(), i.getValue() ); - } + } */ } }; -- cgit v1.2.3