1brc icon indicating copy to clipboard operation
1brc copied to clipboard

bug: beyond the bound of chunk

Open bbqz007 opened this issue 1 year ago • 1 comments

// this assumes the file ends in a newline...
    const char *end = (char *)memchr(&data[chunk_end], '\n', chunk_size) + 1;

data[chunk_end] is over the limit, the end of the chunk is data[chunk_end-1]

when the last workthread access the data[chunk_end], make SIGSEGV. i try nthread of 2,4,8. the problem issues.

bbqz007 avatar Apr 18 '24 15:04 bbqz007

Did you create the measurements file using the provided program or from somewhere else? The last two bytes of the memory mapped file should be “\n\0”.But yeah, since this is not in the hot loop I should probably clean that up. :-)Op 18 apr. 2024 om 17:01 heeft bbqz007 @.***> het volgende geschreven: // this assumes the file ends in a newline... const char *end = (char *)memchr(&data[chunk_end], '\n', chunk_size) + 1;

data[chunk_end] is over the limit, the end of the chunk is data[chunk_end-1] when the last workthread access the data[chunk_end], make SIGSEGV. i try nthread of 2,4,8. the problem issues.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

dannyvankooten avatar Apr 18 '24 15:04 dannyvankooten