3 ms·
Instead of "Sun machines", I think you mean Solaris (or SunOS). Sun made both SPARC and x86 machines. You can run Linux on x86 machines. For a bit, I ran Sol
by KMag 6y ago
Instead of "Sun machines", I think you mean Solaris (or SunOS). Sun made both SPARC and x86 machines. You can run Linux on x86 machines. For a bit, I ran Solaris 7 on my x86 desktop.
This double-free behavior was a part of the memory allocator implementation, not a feature of the processor. Linking (or LD_PRELOAD'ing) against another memory allocator could have gotten you the other behavior on either platform.
Note that even with the Solaris memory allocator not corrupting state or abort()ing if you double-freed a pointer, if a second thread in the same process had called malloc() and gotten that same block of memory in the middle of your double-free, then a later malloc() could also get a pointer to that same block of memory, and you'd unintentionally have two unrelated pointers to the same memory block, almost certainly resulting in memory corruption. One of my fist projects at my first job was fixing a bug that turned out to be memory corruption caused by a double-free. Continuing to apparently run fine despite a very serious and hard to debug bug isn't generally considered a good feature.
- KMag 6y agoErr... I mean you can run Linux on both x86 and SPARC machines.