Open KalindiFonda opened 5 years ago
Hello @KalindiFonda Can you please provide me an example of that implementation?
Hi, my code failed when moulinette used a very large fd, and that is because of the way I set my static variable - as it depends on a number (MAX_FD_N) I give it.
static char *r_str[MAX_FD_N];
Would it be useful for you to see my code?
Yes, for sure I am interested in look at your code. It would be nice if you provide me a full example of the issue: a large file and your main.c?
The issue here is not a large file but a large fd.
I have seen implementations like this where essentially a large array of string pointers is initiated as a static variable and accessed simply using r_str[fd] when called.
The problem is that if too many files are open, the fd may be greater than MAX_FD_N. If this value is large enough, you will not have an error (which should be a bus error and not a segfault), but then you're using about 80MB of memory for no reason. It would be interesting to add this test as I have seen a lot of implementations lately that take this (highly inefficient) shortcut
Hello @tobyhw How would you handle tests for that issue? Should we open file descriptors with gnl with huge number of iterations? How many iterations? How to determine when the test is relevant?
if one implements gnl by using a mx_fd option, a very large fd causes a seg fault.