comparison tests/core_tests/test_imagepool.cpp @ 148:72c25cc27d8b

For your convenience pools now have a function called purgeLoadedResources exposed to python which will delete all loaded resources that have a ref count of zero. You can use this after closing a map or something alike. It may however impact performance, as the next map may very well reload the same resources. Just be aware of that. :-)
author phoku@33b003aa-7bff-0310-803a-e67f0ece8222
date Sat, 11 Oct 2008 06:05:11 +0000
parents 35f6cfea565e
children 376b8afc9a18
comparison
equal deleted inserted replaced
147:fb6ccb367dd1 148:72c25cc27d8b
123 CHECK_EQUAL(3, pool.getResourceCount(RES_LOADED)); 123 CHECK_EQUAL(3, pool.getResourceCount(RES_LOADED));
124 CHECK_EQUAL(0, pool.getResourceCount(RES_NON_LOADED)); 124 CHECK_EQUAL(0, pool.getResourceCount(RES_NON_LOADED));
125 } 125 }
126 CHECK_EQUAL(3, pool.getResourceCount(RES_LOADED)); 126 CHECK_EQUAL(3, pool.getResourceCount(RES_LOADED));
127 CHECK_EQUAL(0, pool.getResourceCount(RES_NON_LOADED)); 127 CHECK_EQUAL(0, pool.getResourceCount(RES_NON_LOADED));
128 pool.clear(); 128
129 CHECK_EQUAL(3, pool.purgeLoadedResources() );
130
131 CHECK_EQUAL(0, pool.getResourceCount(RES_LOADED));
132 CHECK_EQUAL(3, pool.getResourceCount(RES_NON_LOADED));
133 pool.reset();
129 CHECK_EQUAL(0, pool.getResourceCount(RES_LOADED)); 134 CHECK_EQUAL(0, pool.getResourceCount(RES_LOADED));
130 CHECK_EQUAL(0, pool.getResourceCount(RES_NON_LOADED)); 135 CHECK_EQUAL(0, pool.getResourceCount(RES_NON_LOADED));
131 } 136 }
132 137
133 // need this here because SDL redefines 138 // need this here because SDL redefines