Skip to content

Random Values in Pointers

philpearl.github.io
35 pointskaragenit2 comments
On HN

Comments

putting bad values into pointer variables in gc'd languages is arguably worse than doing so in non-gc'd ones. i'd say that gc'd languages should prevent you from doing it.

A while ago, I was using an emulator for a 32-bit processor I was writing code for. To detect access of non-initialized storage, instead of having an out-of-band bit for each word, it stored hex deadbeef in each word before program start and, at each memory read, checked for this. If it was found, the enulator halted with an error.

This was very handy in catching errors. I never saw this particular word actually generated, so it never indicated a false error.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.