Don't enumerate io->blocking_operations
if fork generation is different. (#13359)
This commit is contained in:
parent
35000ac2ed
commit
a0fe0095ab
Notes:
git
2025-05-16 05:14:37 +00:00
Merged-By: ioquatix <samuel@codeotaku.com>
9
io.c
9
io.c
@ -5692,8 +5692,13 @@ rb_io_memsize(const rb_io_t *io)
|
||||
if (io->writeconv) size += rb_econv_memsize(io->writeconv);
|
||||
|
||||
struct rb_io_blocking_operation *blocking_operation = 0;
|
||||
ccan_list_for_each(&io->blocking_operations, blocking_operation, list) {
|
||||
size += sizeof(struct rb_io_blocking_operation);
|
||||
|
||||
// Validate the fork generation of the IO object. If the IO object fork generation is different, the list of blocking operations is not valid memory. See `rb_io_blocking_operations` for the exact semantics.
|
||||
rb_serial_t fork_generation = GET_VM()->fork_gen;
|
||||
if (io->fork_generation == fork_generation) {
|
||||
ccan_list_for_each(&io->blocking_operations, blocking_operation, list) {
|
||||
size += sizeof(struct rb_io_blocking_operation);
|
||||
}
|
||||
}
|
||||
|
||||
return size;
|
||||
|
Loading…
x
Reference in New Issue
Block a user