[webkit-dev] strdup in WebKit
KwangYul Seo
kwangyul.seo at gmail.com
Wed Jan 20 02:07:26 PST 2010
Hi,
WebKit does not use malloc/free directly in favor of fastMalloc/fastFree.
The only exception to this rule is strdup() which returns a memory that must
be freed by free. Why don't we add fastStrDup which allocates a memory with
fastMalloc? The memory returned by fastStrDup can be freed by fastFree.
The following source files in WebCore contains strdup calls.
dom/XMLTokenizerLibxml2.cpp
plugins/PluginStream.cpp
platform/network/ResourceHandleInternal.h
platform/network/curl/ResourceHandleManager.cpp
platform/network/curl/ResourceHandleCurl.cpp
xml/XSLTProcessorLibxslt.cpp
bindings/v8/npruntime.cpp
bindings/v8/V8NPUtils.cpp
bridge/IdentifierRep.h
bridge/jni/jni_runtime.cpp
bridge/jni/jsc/JavaClassJSC.cpp
bridge/npruntime.cpp
bridge/testbindings.cpp
strdup/free pairs can be safely replaced with fastStrDup/fastFree in most
cases. However, bridge and bindings can be an exception because some APIs
must return malloc() allocated memory that can be freed with free().
I am asking this because strdup (POSIX function) is not available in RVCT.
If this is not possible for some reasons, adding strdup to StringExtras.h
for RVCT can be a good solution too. How does the Symbian QT port solve this
problem?
Regards,
Kwang Yul Seo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100120/75f60aa5/attachment.html>
More information about the webkit-dev
mailing list