News for hackers. Stuff that matters.
Re:The C standard library function atexit is broken by zingermc on Wednesday June 19, 2019 @10:26PM (#20229296)
What if the OS could dedupe pages?
Re:The C standard library function atexit is broken by adrianmonk on Thursday June 20, 2019 @01:21AM (#20230129)
You'd need to arrange for the linking process to result in identical (and identically-aligned!) code pages. If you're going to all the trouble to ensure that, why not just write it all to a file and call it a shared library?
Re:The C standard library function atexit is broken by bayareanative on Thursday June 20, 2019 @06:08AM (#20231358)
Exactly. Emperors' new clothes from naive convention abandonment of solved problems.
Re:The C standard library function atexit is broken by loeg on Thursday June 20, 2019 @01:00AM (#20230029)
On the fly memory dedupe is incredibly expensive. Especially compared to just not duplicating in the first place.

Also, it's quite likely that static linked libraries wouldn't be located at the exact same page offsets every time they're linked in to a binary, making page-level dedupe not useful.

Re:The C standard library function atexit is broken by sebcat on Thursday June 20, 2019 @01:38AM (#20230207)
What if the OS could map a shared object that resides in one section of memory into the virtual address space of multiple processes?
Re:The C standard library function atexit is broken by kelnos on Wednesday June 19, 2019 @11:28PM (#20229593)
Do any OSes actually do this, though? If not, this is academic until one actually does.

Linux does have something called "KSM" that de-dupes memory pages, but it appears that it's only so a hypervisor can de-dupe guest OS pages? Odd that it's not more general than that. Though I guess there is a cost: the KSM code needs to scan through memory to find duplicate pages, which I can't imagine is fast.

Re:The C standard library function atexit is broken by choeger on Thursday June 20, 2019 @04:06AM (#20230860)
Would not work with any kind of LTO.