[webkit-dev] Strict OwnPtr now (partially) enabled

Adam Barth abarth at webkit.org
Wed Apr 27 15:31:09 PDT 2011


Thanks to a bunch of hard work at the WebKit meeting (both as part of
the OwnPtr hack-a-thon and "after hours"), we've now enabled strict
OwnPtr semantics on PLATFORM(MAC).  Other platforms should follow
shortly as we work through the platform-specific files.

The strict semantics mean you'll no longer be able to store a raw
pointer in an OwnPtr without first calling adoptPtr.  Ideally, you
should call adoptPtr immediately after calling new:

adoptPtr(new AwesomeClass(42))

OwnPtr will ensure that the allocated memory is freed exactly once,
avoiding memory leaks and double-frees.  There's still some more work
to enable strict mode for PassOwnPtr, but hopefully we'll be able to
turn that on soon as well.

Thanks for all your help everyone, and happy memory management!

Adam


More information about the webkit-dev mailing list