Thanks, Adam. This project will be worthwhile.

I think we may want to write a document about this that goes alongside 
<http://webkit.org/coding/RefPtr.html> because I’m sure there will be 
frequently-asked questions.

On Aug 24, 2010, at 10:46 AM, Adam Barth wrote:

> In the cases where we have an intentional memory leak (e.g., for a static), 
> please use the leakPtr() member function to document the leak.

This means that we might have code that looks like this:

    static NiftyNonRefCountedObject* singleNeverToBeDeletedInstance = 
adoptPtr(new NiftyNonRefCountedObject).leakPtr();

Then later, we could refactor it to look like this:

    static NiftyNonRefCountedObject* singleNeverToBeDeletedInstance = 
NiftyNonRefCountedObject::create().leakPtr();

These changes will make leaks and double deletion mistakes less likely.

    -- Darin

_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to