I guess we should probably memoize this, since it is likely to get called repeatedly in the life of a running process.