kHandleZapValue being legitimately allocated

14 views
Skip to first unread message

Matt Seegmiller

unread,
Jun 25, 2010, 10:44:49 AM6/25/10
to v8-u...@googlegroups.com
I've got a situation where I had an assert running debug saying that a
handle points to the kHandleZapValue constant. However, it actually
looks like the handle is perfectly legitimate. kHandleZapValue points
is 0x0baddead, which looks like a perfectly valid HeapObject address,
and I have something that is a HeapObject (a FixedArray, actually) at
that address, and looking at the memory at 0x0baddead, it looks valid.

So my question is, why isn't kHandleZapValue (and kZapValue and
kFromSpaceZapValue for that matter) an even value that can't possibly
be a HeapObject pointer? And does it seem possible that there would
be a valid allocation at the address 0x0baddead?

matt

Stephan Beal

unread,
Jun 25, 2010, 12:58:04 PM6/25/10
to v8-u...@googlegroups.com
On Fri, Jun 25, 2010 at 4:44 PM, Matt Seegmiller <ma...@muzzylane.com> wrote:
So my question is, why isn't kHandleZapValue (and kZapValue and
kFromSpaceZapValue for that matter) an even value that can't possibly
be a HeapObject pointer?  And does it seem possible that there would
be a valid allocation at the address 0x0baddead?


An even more reliable option, IMO, though possibly not as performant, is to use the address of a static stack-allocated object, e.g.:

// private:
static const int zapper = 1; 
// public:
const void * kHandleZapValue = &zapper;

granted, the address may be different between runs, but it's guaranteed to never be either dynamically nor statically allocated for any other purpose.

--
----- stephan beal
http://wanderinghorse.net/home/stephan/
Reply all
Reply to author
Forward
0 new messages