Purpose of SkNEW and SkDELETE?

36 views
Skip to first unread message

Matthew Dempsky

unread,
Aug 18, 2015, 1:49:22 PM8/18/15
to skia-discuss
I'm trying to understand what purpose SkNEW, SkDELETE, and their related macros serve.  They're relatively consistently used, but I still see occasional uses of raw "new" and "delete" in Skia.  I'm wondering if those are intentional or accidental and what the consequences are.

Tracking back through Git commit history, I find they were added in commit 8a1c16ff (Dec 2008) with a brief "grab from latest android" commit message.

Thanks.

Leon Scroggins

unread,
Aug 26, 2015, 5:24:36 PM8/26/15
to skia-d...@googlegroups.com
If I understand correctly, these macros were used to allow a client of Skia to differentiate between memory allocated by Skia versus other memory allocations.

We are not aware of anyone still taking advantage of this feature, so the macros have been removed.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.



--
Leon Scroggins III
scr...@google.com

Mike Klein

unread,
Aug 26, 2015, 5:32:51 PM8/26/15
to skia-d...@googlegroups.com
Actually, the macros are still there, but our use of them inside Skia has been removed.  We'll need to take a pass at projects outside Skia (Chrome, CrOs, Android?) using the macros before we can really kill them.  :)

Please do go ahead now with new, delete, new[], and delete[] inside Skia.  Feel free to write as normal not-weird C++ as possible.
Reply all
Reply to author
Forward
0 new messages