2016-07-31 04:20:21 +08:00
|
|
|
#include "common.h"
|
|
|
|
|
2016-09-14 01:08:34 +08:00
|
|
|
constexpr size_t THREADS_NO = std::min(max_no_threads, 8);
|
2016-07-31 04:20:21 +08:00
|
|
|
constexpr size_t elements = 2e6;
|
|
|
|
|
2016-12-22 22:51:16 +08:00
|
|
|
/**
|
|
|
|
* Put elements number of elements in the skiplist per each thread and see
|
|
|
|
* is there any memory leak
|
|
|
|
*/
|
2017-02-18 18:54:37 +08:00
|
|
|
int main() {
|
|
|
|
init_log();
|
2016-12-22 22:51:16 +08:00
|
|
|
|
2017-02-18 18:54:37 +08:00
|
|
|
memory_check(THREADS_NO, [] {
|
|
|
|
map_t skiplist;
|
2016-07-31 04:20:21 +08:00
|
|
|
|
2017-02-18 18:54:37 +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;
|
2016-08-15 07:09:58 +08:00
|
|
|
});
|
2017-02-18 18:54:37 +08:00
|
|
|
collect(futures);
|
|
|
|
|
|
|
|
auto accessor = skiplist.access();
|
|
|
|
check_size<map_t>(accessor, elements);
|
|
|
|
});
|
2016-07-31 04:20:21 +08:00
|
|
|
}
|