void test1() { ObjectPool<SmallObject> op; SmallObject* s = op.get(); op.put(s); s = op.get(); s = op.get(); s = op.get(); s = op.get(); printf("++++++++++++++++\n"); }
void test2() { TimeFilm tm("object pool: "); ObjectPool<SmallObject> op; SmallObject* s = 0; //int m = 1000000; int m = 100; Random rnd; const char* hello = "hello"; while (--m) { //s = op.get(); s = op.get(m,hello); #if 1 if (s && rnd(2)) { printf("put\n"); op.put(s); } #endif } }