-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Description
In src/task.c, function jl_new_task
does the following:
...
if (ssize == 0) {
...
}
else {
// user requested dedicated stack of a certain size
if (ssize < MINSTKSZ)
ssize = MINSTKSZ;
t->bufsz = ssize;
t->stkbuf = jl_alloc_fiber(&t->ctx, &t->bufsz, t);
if (t->stkbuf == NULL)
jl_throw(jl_memory_exception);
}
...
t->stkbuf = NULL;
So if ssize != 0
then t->stkbuf
is allocated and care is taken to ensure it's non-zero, but then later it gets zeroed out unconditionally (no return
or conditional statement statement comes in between, so I really think this is what happens).
This looks like a bug, presumably t->stkbuf
. Even if it is intentional, then I'd think the first use of t->stkbuf
inside the else {...}
block should be rather replaced by a local variable, and a comment should be added why this makes sense.
Metadata
Metadata
Assignees
Labels
No labels