-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sdb unit test for sorting big lists #130
Conversation
|
thats why it segfaults :P |
fixed your test case and its not crashing at all this is not a valid test for your issue |
also you are not checking if the resulting list is sorted or not |
I thougt we didn't had in that case as long as it didn't crashed. Argh back to reproducing then, sorry >_> |
i am sorting 10 million items in this SdbList without any stack exhaustion or crash problem |
diff --git a/test/unit/test_sdb.c b/test/unit/test_sdb.c
index 95f29f6..4d76430 100644
--- a/test/unit/test_sdb.c
+++ b/test/unit/test_sdb.c
@@ -50,11 +50,12 @@ static int __cmp_asc(const void *a, const void *b) {
bool test_sdb_list_big(void) {
Sdb *db = sdb_new (NULL, NULL, false);
int i;
- for ( i=1; i < 100000; i++) {
- sdb_set (db, i-1, i, 0);
+ for ( i=0; i < 10000; i++) {
+ sdb_num_set (db, sdb_fmt (0, "%d", i), i + 1, 0);
}
SdbList *list = sdb_foreach_list (db, true);
- ls_sort(list, __cmp_asc);
+ ls_sort (list, __cmp_asc);
+// TODO: verify if its sorted
sdb_free (db);
mu_end;
} |
Patch applied, any idea on how to reproduce the issue then? |
Also confirm it works here too even though that was to be expected: |
Got a segfault at 10M here, will try to reproduce at lower count and add here. Tooked a lot of time tho |
10 million items. The hash is a table of lists, maybe some stats to see how many items are in each bucket may help to identify the issue
… On 25 Mar 2017, at 22:30, GovanifY ***@***.***> wrote:
Got a segfault at 10M here, will try to reproduce at lower count and add here. Tooked a lot of time tho
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
But maybe we have reached a limit in mmap
… On 25 Mar 2017, at 22:30, GovanifY ***@***.***> wrote:
Got a segfault at 10M here, will try to reproduce at lower count and add here. Tooked a lot of time tho
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Test is pretty slow in its current form but works™ |
There is a chance, for mmap, I'll check that later, thanks for pointing out |
} | ||
SdbList *list = sdb_foreach_list (db, true); | ||
ls_sort (list, __cmp_asc); | ||
// TODO: verify if its sorted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you are sorting twice since sdb_foreach_list with the true flag already does the same operation as below
Working on this btw |
Fixed in master. I lowered the amount to sort to Test again please and tell me. |
For now this unit test triggers a crash, related to radareorg/radare2#7079