-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Possible bug when constructing a string from an array of characters #54275
Comments
I don't think any of those fields exist anymore. Are you sure you are looking at master and not an older release? |
Ah sorry, that's on our fork of Julia, which is a patched 1.10 (will edit the comment above to provide a clarification on that). But yes, the issue reproduces on stock 1.10. |
one thing worth checking. does the actual memory use increase or is it just a live_bytes reporting issue? |
RSS stays the same, just static void jl_gc_free_array(jl_array_t *a) JL_NOTSAFEPOINT
{
if (a->flags.how == 2) {
char *d = (char*)a->data - a->offset*a->elsize;
if (a->flags.isaligned)
jl_free_aligned(d);
else
free(d);
gc_num.freed += jl_array_nbytes(a);
gc_num.freecall++;
}
} The fact that the length is zero-ed out here won't change the fact that |
…54331) Master version of JuliaLang#54309. Should fix JuliaLang#54275. --------- Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Consider the MWE provided by @tveldhui:
If we run it,
gc_live_bytes
seems to increase at a rate of 10MB/iteration:I'm not totally familiar with the Julia array implementation, but this seems to be stemming from a bug in the
jl_array_to_string
implementation:On the latest commit of our fork at the time of writing (and also on stock 1.10), it seems like the
jl_pchar_to_string
called at the very end ofjl_array_to_string
will allocate a separate buffer for itself and copy the contents of the array into it:This raises the question: if a new buffer is allocated to the string, and the contents of the array buffer are copied into it, what's the purpose of these three lines?
Seems like we should not have them.
Commenting these three lines seems to solve the issue raised in the MWE above, but again, I'm not fully knowledgeable in this part of the codebase to know whether this proposed change makes sense.
Patch:
And new results after applying it:
The text was updated successfully, but these errors were encountered: