2016-07-31 04:20:21 +08:00
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
#define THREADS_NO 8
|
|
|
|
|
|
|
|
constexpr size_t elements = 2e6;
|
|
|
|
|
|
|
|
// Test for simple memory leaks
|
2016-07-31 20:56:13 +08:00
|
|
|
int main()
|
|
|
|
{
|
2016-08-15 07:09:58 +08:00
|
|
|
init_log();
|
|
|
|
memory_check(THREADS_NO, [] {
|
|
|
|
map_t skiplist;
|
2016-07-31 04:20:21 +08:00
|
|
|
|
2016-08-15 07:09:58 +08:00
|
|
|
auto futures =
|
|
|
|
run<size_t>(THREADS_NO, skiplist, [](auto acc, auto index) {
|
|
|
|
for (size_t i = 0; i < elements; i++) {
|
|
|
|
acc.insert(i, index);
|
|
|
|
}
|
|
|
|
return index;
|
|
|
|
});
|
|
|
|
collect(futures);
|
2016-08-02 20:23:39 +08:00
|
|
|
|
2016-08-15 07:09:58 +08:00
|
|
|
auto accessor = skiplist.access();
|
|
|
|
check_size<map_t>(accessor, elements);
|
|
|
|
});
|
2016-07-31 04:20:21 +08:00
|
|
|
}
|