4 ms·
This is really interesting, and I think 32-bit pointers make sense for a significant class of problems. At the very least, having the option could be useful. Bu
by correct_horse 7y ago
This is really interesting, and I think 32-bit pointers make sense for a significant class of problems. At the very least, having the option could be useful. But...
One time in node, building a react-native project, the build failed with
`FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory`. (see issue here: https://github.com/expo/expo-cli/issues/94 https://github.com/expo/expo-cli/issues/94)
I ended up fixing it with
`export NODE_OPTIONS=--max_old_space_size=8000`
But it took a while to find that. In an era where developer experience is king, maybe the default should be 64-bit pointers with an option for 32-bit.
Also if a 32-bit pointer type option existed in say C, I worry that programmers would abuse it, chasing performance at the expense of bugs.
- flohofwoe 7y agoIMHO the best alternative to pointers is "tagged index handles" as described here: https://floooh.github.io/2018/06/17/handles-vs-pointers.html https://floooh.github.io/2018/06/17/handles-vs-pointers.html This approach drastically reduces the risk of memory corruption in usafe languages, and at the same time keeps data structures compact because handles rarely need to be 64-bits (it's a bit similar to the compressed pointers described in the original post, basically split pointers into a "private" base pointer, and a public offset/index, and use some bits in the public value for dangling protection).