| 70 |
printf("Check key %d [%s] len=%ld\n", i, keys[i], strlen(keys[i])); |
printf("Check key %d [%s] len=%ld\n", i, keys[i], strlen(keys[i])); |
| 71 |
} |
} |
| 72 |
|
|
| 73 |
if (trie_dict_init(TRIE_DICT_SHM_FILE) < 0) |
if (trie_dict_init(TRIE_DICT_SHM_FILE, TRIE_NODE_PER_POOL) < 0) |
| 74 |
{ |
{ |
| 75 |
printf("trie_dict_init failed\n"); |
printf("trie_dict_init failed\n"); |
| 76 |
return -1; |
return -1; |
| 212 |
} |
} |
| 213 |
} |
} |
| 214 |
|
|
| 215 |
|
printf("Total nodes used = %d\n", trie_dict_used_nodes()); |
| 216 |
|
|
| 217 |
trie_dict_destroy(p_dict); |
trie_dict_destroy(p_dict); |
| 218 |
p_dict = NULL; |
p_dict = NULL; |
| 219 |
|
|
| 220 |
|
printf("Total nodes used = %d\n", trie_dict_used_nodes()); |
| 221 |
|
|
| 222 |
printf("Testing #2 ...\n"); |
printf("Testing #2 ...\n"); |
| 223 |
|
|
| 224 |
for (int i = 0; i < 100000; i++) |
for (int i = 0; i < 100000; i++) |
| 247 |
// printf("unload_trie_dict_shm() error\n"); |
// printf("unload_trie_dict_shm() error\n"); |
| 248 |
// } |
// } |
| 249 |
|
|
| 250 |
|
printf("Total nodes used = %d, after set_shm_readonly\n", trie_dict_used_nodes()); |
| 251 |
|
|
| 252 |
trie_dict_cleanup(); |
trie_dict_cleanup(); |
| 253 |
|
|
| 254 |
|
printf("Total nodes used = %d, after cleanup\n", trie_dict_used_nodes()); |
| 255 |
|
|
| 256 |
printf("Done\n"); |
printf("Done\n"); |
| 257 |
|
|
| 258 |
if (unlink(TRIE_DICT_SHM_FILE) < 0) |
if (unlink(TRIE_DICT_SHM_FILE) < 0) |