[webkit-help] Memory leak after run g_main_loop_run(fixture->loop);
feng lu
amuseme.lu at gmail.com
Sun Sep 19 00:33:47 PDT 2010
Hi, everyone ,i am a novice of WebKit. I want to use it to parse html
and javascript and finally get the DOM of that html. But when i have
written a test programme and run it. The problem is happen, The memory
is grow up rapidly when i parse 1000 html pages that is download from
web. it use 1GB memory. i find some meory leak when i use Valgrind to
check it. The leak summary like this:
------------------------------------------------------------------------------------
==3860== LEAK SUMMARY:
==3860== definitely lost: 11,718 bytes in 63 blocks
==3860== indirectly lost: 25,264 bytes in 784 blocks
==3860== possibly lost: 1,678,110 bytes in 25,809 blocks
==3860== still reachable: 1,139,514 bytes in 6,582 blocks
==3860== suppressed: 0 bytes in 0 blocks
==3860== Reachable blocks (those to which a pointer was found) are not shown.
==3860== To see them, rerun with: --leak-check=full --show-reachable=yes
==3860==
==3860== For counts of detected and suppressed errors, rerun with: -v
==3860== Use --track-origins=yes to see where uninitialised values come from
==3860== ERROR SUMMARY: 1948 errors from 1736 contexts (suppressed: 57 from 9)
and some definitely leaks are like this:
==3860== 20 bytes in 1 blocks are definitely lost in loss record 1,847 of 5,419
==3860== at 0x4C284A8: malloc (vg_replace_malloc.c:236)
==3860== by 0x9C78C77: __vasprintf_chk (vasprintf_chk.c:82)
==3860== by 0x8D3C8FA: g_vasprintf (in /lib/libglib-2.0.so.0.2400.1)
==3860== by 0x8D1C61F: g_strdup_vprintf (in /lib/libglib-2.0.so.0.2400.1)
==3860== by 0x8D1C6BC: g_strdup_printf (in /lib/libglib-2.0.so.0.2400.1)
==3860== by 0x1B68AE03: NP_GetMIMEDescription (in
/usr/lib/mozilla/plugins/libtotem-mully-plugin.so)
==3860== by 0x5891EFD: WebCore::PluginPackage::fetchInfo() (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x55F5623:
WebCore::PluginPackage::createPackage(WTF::String const&, long const&)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x55EFDA5: WebCore::PluginDatabase::refresh() (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x55F079E:
WebCore::PluginDatabase::installedPlugins(bool) (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x54F8681:
WebCore::FrameLoader::defaultObjectContentType(WebCore::KURL const&,
WTF::String const&) (in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x547184D:
WebCore::HTMLPlugInImageElement::isImageType() (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x5444EB9:
WebCore::HTMLEmbedElement::parseMappedAttribute(WebCore::Attribute*)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x5366FDE:
WebCore::StyledElement::attributeChanged(WebCore::Attribute*, bool)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x5444843:
WebCore::HTMLEmbedElement::attributeChanged(WebCore::Attribute*, bool)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x532F120:
WebCore::Element::setAttributeMap(WTF::PassRefPtr<WebCore::NamedNodeMap>,
WebCore::FragmentScriptingPermission) (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x543A9FE:
WebCore::HTMLConstructionSite::createHTMLElement(WebCore::AtomicHTMLToken&)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x543B0AB:
WebCore::HTMLConstructionSite::insertSelfClosingHTMLElement(WebCore::AtomicHTMLToken&)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x542678E:
WebCore::HTMLTreeBuilder::processStartTagForInBody(WebCore::AtomicHTMLToken&)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x5427675:
WebCore::HTMLTreeBuilder::processStartTag(WebCore::AtomicHTMLToken&)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x542BAD2:
WebCore::HTMLTreeBuilder::constructTreeFromToken(WebCore::HTMLToken&)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x541D731:
WebCore::HTMLDocumentParser::pumpTokenizer(WebCore::HTMLDocumentParser::SynchronousMode)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x541DDB9:
WebCore::HTMLDocumentParser::append(WebCore::SegmentedString const&)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x53079BE:
WebCore::DecodedDataDocumentParser::appendBytes(WebCore::DocumentWriter*,
char const*, int, bool) (in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x58AA038:
WebKit::FrameLoaderClient::committedLoad(WebCore::DocumentLoader*,
char const*, int) (in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x54DF4C3: WebCore::DocumentLoader::commitLoad(char
const*, int) (in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x551A75E: WebCore::ResourceLoader::didReceiveData(char
const*, int, long long, bool) (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x550BBC4:
WebCore::MainResourceLoader::didReceiveData(char const*, int, long
long, bool) (in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x550E357:
WebCore::MainResourceLoader::continueAfterContentPolicy(WebCore::PolicyAction,
WebCore::ResourceResponse const&) (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x550E545:
WebCore::MainResourceLoader::continueAfterContentPolicy(WebCore::PolicyAction)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x550EEF8:
WebCore::MainResourceLoader::didReceiveResponse(WebCore::ResourceResponse
const&) (in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x550D0CA:
WebCore::MainResourceLoader::handleDataLoadNow(WebCore::Timer<WebCore::MainResourceLoader>*)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x55AC7E5:
WebCore::ThreadTimers::sharedTimerFiredInternal() (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x587F6F1: WebCore::timeout_cb(void*) (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x8CFB09A: ??? (in /lib/libglib-2.0.so.0.2400.1)
==3860== by 0x8CFA8C1: g_main_context_dispatch (in
/lib/libglib-2.0.so.0.2400.1)
==3860== by 0x8CFE747: ??? (in /lib/libglib-2.0.so.0.2400.1)
==3860== by 0x8CFEC54: g_main_loop_run (in /lib/libglib-2.0.so.0.2400.1)
==3860== by 0x4065B8: main (domtest.cpp:125)
==3860== 96 bytes in 3 blocks are definitely lost in loss record 4,457 of 5,419
==3860== at 0x4C28CC1: operator new(unsigned long) (vg_replace_malloc.c:261)
==3860== by 0x184EE37D: acommon::DictInfoList::elements() const (in
/usr/lib/libaspell.so.15.1.4)
==3860== by 0x182B22A4: ??? (in /usr/lib/enchant/libenchant_aspell.so)
==3860== by 0xA1049AD: ??? (in /usr/lib/libenchant.so.1.6.0)
==3860== by 0xA1050D7: enchant_broker_dict_exists (in
/usr/lib/libenchant.so.1.6.0)
==3860== by 0x58C01D4: webkit_web_settings_set_property(_GObject*,
unsigned int, _GValue const*, _GParamSpec*) (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x84758DC: ??? (in /usr/lib/libgobject-2.0.so.0.2400.1)
==3860== by 0x8476840: g_object_newv (in /usr/lib/libgobject-2.0.so.0.2400.1)
==3860== by 0x847750B: g_object_new (in /usr/lib/libgobject-2.0.so.0.2400.1)
==3860== by 0x58BF2D9: webkit_web_settings_new (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x58CB8DA: webkit_web_view_init(_WebKitWebView*) (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x8491934: g_type_create_instance (in
/usr/lib/libgobject-2.0.so.0.2400.1)
==3860== by 0x847583B: ??? (in /usr/lib/libgobject-2.0.so.0.2400.1)
==3860== by 0x8476CC9: g_object_newv (in /usr/lib/libgobject-2.0.so.0.2400.1)
==3860== by 0x847750B: g_object_new (in /usr/lib/libgobject-2.0.so.0.2400.1)
==3860== by 0x58C3759: webkit_web_view_new (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x406500: main (domtest.cpp:117)
==3860== 300 (60 direct, 240 indirect) bytes in 1 blocks are
definitely lost in loss record 4,866 of 5,419
==3860== at 0x4C284A8: malloc (vg_replace_malloc.c:236)
==3860== by 0x9C747EA: nss_parse_service_list (nsswitch.c:622)
==3860== by 0x9C7510D: __nss_database_lookup (nsswitch.c:164)
==3860== by 0x120233CF: ???
==3860== by 0x12024184: ???
==3860== by 0x9C2348C: getpwnam_r@@GLIBC_2.2.5 (getXXbyYY_r.c:253)
==3860== by 0x8D2E44C: ??? (in /lib/libglib-2.0.so.0.2400.1)
==3860== by 0x8D30264: g_get_home_dir (in /lib/libglib-2.0.so.0.2400.1)
==3860== by 0x6619036: ??? (in /usr/lib/libgtk-x11-2.0.so.0.2000.1)
==3860== by 0x661B6FE: ??? (in /usr/lib/libgtk-x11-2.0.so.0.2000.1)
==3860== by 0x65CD404: ??? (in /usr/lib/libgtk-x11-2.0.so.0.2000.1)
==3860== by 0x8D09C07: g_option_context_parse (in
/lib/libglib-2.0.so.0.2400.1)
==3860== by 0x65CD040: gtk_parse_args (in
/usr/lib/libgtk-x11-2.0.so.0.2000.1)
==3860== by 0x65CD098: gtk_init_check (in
/usr/lib/libgtk-x11-2.0.so.0.2000.1)
==3860== by 0x65CD0C8: gtk_init (in /usr/lib/libgtk-x11-2.0.so.0.2000.1)
==3860== by 0x4063AD: main (domtest.cpp:99)
==3860== 736 (512 direct, 224 indirect) bytes in 2 blocks are
definitely lost in loss record 4,993 of 5,419
==3860== at 0x4C284A8: malloc (vg_replace_malloc.c:236)
==3860== by 0x7F94FC5: ??? (in /usr/lib/libfontconfig.so.1.4.4)
==3860== by 0x7F95AF7: ??? (in /usr/lib/libfontconfig.so.1.4.4)
==3860== by 0x7F95C09: ??? (in /usr/lib/libfontconfig.so.1.4.4)
==3860== by 0x7F99E1B: ??? (in /usr/lib/libfontconfig.so.1.4.4)
==3860== by 0x7F9A764: ??? (in /usr/lib/libfontconfig.so.1.4.4)
==3860== by 0x10351B52: ??? (in /lib/libexpat.so.1.5.2)
==3860== by 0x103529CD: ??? (in /lib/libexpat.so.1.5.2)
==3860== by 0x103538C9: ??? (in /lib/libexpat.so.1.5.2)
==3860== by 0x10354C1A: ??? (in /lib/libexpat.so.1.5.2)
==3860== by 0x1034B071: XML_ParseBuffer (in /lib/libexpat.so.1.5.2)
==3860== by 0x7F98931: FcConfigParseAndLoad (in
/usr/lib/libfontconfig.so.1.4.4)
==3860== by 0x7F98BFE: FcConfigParseAndLoad (in
/usr/lib/libfontconfig.so.1.4.4)
==3860== by 0x7F9A26F: ??? (in /usr/lib/libfontconfig.so.1.4.4)
==3860== by 0x10351B52: ??? (in /lib/libexpat.so.1.5.2)
==3860== by 0x103529CD: ??? (in /lib/libexpat.so.1.5.2)
==3860== by 0x103538C9: ??? (in /lib/libexpat.so.1.5.2)
==3860== by 0x10354C1A: ??? (in /lib/libexpat.so.1.5.2)
==3860== by 0x1034B071: XML_ParseBuffer (in /lib/libexpat.so.1.5.2)
==3860== by 0x7F98931: FcConfigParseAndLoad (in
/usr/lib/libfontconfig.so.1.4.4)
==3860== by 0x7F8EE06: FcInitLoadConfig (in /usr/lib/libfontconfig.so.1.4.4)
==3860== by 0x7F8EEE5: FcInitLoadConfigAndFonts (in
/usr/lib/libfontconfig.so.1.4.4)
==3860== by 0x7F8EFC4: FcInit (in /usr/lib/libfontconfig.so.1.4.4)
==3860== by 0x5898934: WebCore::FontPlatformData::init() (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x55B6DB1:
WebCore::FontCache::getCachedFontPlatformData(WebCore::FontDescription
const&, WTF::AtomicString const&, bool) (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x55B6FDB:
WebCore::FontCache::getCachedFontData(WebCore::FontDescription const&,
WTF::AtomicString const&, bool) (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x55B7309:
WebCore::FontCache::getFontData(WebCore::Font const&, int&,
WebCore::FontSelector*) (in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x55B9D29:
WebCore::FontFallbackList::fontDataAt(WebCore::Font const*, unsigned
int) const (in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x55B45E1: WebCore::Font::floatWidth(WebCore::TextRun
const&, WTF::HashSet<WebCore::SimpleFontData const*,
WTF::PtrHash<WebCore::SimpleFontData const*>,
WTF::HashTraits<WebCore::SimpleFontData const*> >*,
WebCore::GlyphOverflow*) const (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x5663295:
WebCore::RenderImage::setImageSizeForAltText(WebCore::CachedImage*)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x543BF73: WTF::PassRefPtr<WebCore::Element>
WebCore::HTMLConstructionSite::attach<WebCore::Element>(WebCore::Node*,
WTF::PassRefPtr<WebCore::Element>) (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x543B065:
WebCore::HTMLConstructionSite::attachToCurrent(WTF::PassRefPtr<WebCore::Element>)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x543B0B9:
WebCore::HTMLConstructionSite::insertSelfClosingHTMLElement(WebCore::AtomicHTMLToken&)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x542678E:
WebCore::HTMLTreeBuilder::processStartTagForInBody(WebCore::AtomicHTMLToken&)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x5427675:
WebCore::HTMLTreeBuilder::processStartTag(WebCore::AtomicHTMLToken&)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x542BAD2:
WebCore::HTMLTreeBuilder::constructTreeFromToken(WebCore::HTMLToken&)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x541D731:
WebCore::HTMLDocumentParser::pumpTokenizer(WebCore::HTMLDocumentParser::SynchronousMode)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x541DDB9:
WebCore::HTMLDocumentParser::append(WebCore::SegmentedString const&)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x53079BE:
WebCore::DecodedDataDocumentParser::appendBytes(WebCore::DocumentWriter*,
char const*, int, bool) (in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x58AA038:
WebKit::FrameLoaderClient::committedLoad(WebCore::DocumentLoader*,
char const*, int) (in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x54DF4C3: WebCore::DocumentLoader::commitLoad(char
const*, int) (in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x551A75E: WebCore::ResourceLoader::didReceiveData(char
const*, int, long long, bool) (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x550BBC4:
WebCore::MainResourceLoader::didReceiveData(char const*, int, long
long, bool) (in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x550E357:
WebCore::MainResourceLoader::continueAfterContentPolicy(WebCore::PolicyAction,
WebCore::ResourceResponse const&) (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x550E545:
WebCore::MainResourceLoader::continueAfterContentPolicy(WebCore::PolicyAction)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x550EEF8:
WebCore::MainResourceLoader::didReceiveResponse(WebCore::ResourceResponse
const&) (in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x550D0CA:
WebCore::MainResourceLoader::handleDataLoadNow(WebCore::Timer<WebCore::MainResourceLoader>*)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x55AC7E5:
WebCore::ThreadTimers::sharedTimerFiredInternal() (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x587F6F1: WebCore::timeout_cb(void*) (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x8CFB09A: ??? (in /lib/libglib-2.0.so.0.2400.1)
==3860== 1,488 (512 direct, 976 indirect) bytes in 1 blocks are
definitely lost in loss record 5,197 of 5,419
==3860== at 0x4C285A2: realloc (vg_replace_malloc.c:525)
==3860== by 0x7F95061: ??? (in /usr/lib/libfontconfig.so.1.4.4)
==3860== by 0x7F95AF7: ??? (in /usr/lib/libfontconfig.so.1.4.4)
==3860== by 0x7F926A4: FcFontRenderPrepare (in
/usr/lib/libfontconfig.so.1.4.4)
==3860== by 0x7F9282C: FcFontMatch (in /usr/lib/libfontconfig.so.1.4.4)
==3860== by 0x5898EE1:
WebCore::FontPlatformData::FontPlatformData(WebCore::FontDescription
const&, WTF::AtomicString const&) (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x585B691:
WebCore::FontCache::createFontPlatformData(WebCore::FontDescription
const&, WTF::AtomicString const&) (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x55B6B6B:
WebCore::FontCache::getCachedFontPlatformData(WebCore::FontDescription
const&, WTF::AtomicString const&, bool) (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x55B6FDB:
WebCore::FontCache::getCachedFontData(WebCore::FontDescription const&,
WTF::AtomicString const&, bool) (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x55B7309:
WebCore::FontCache::getFontData(WebCore::Font const&, int&,
WebCore::FontSelector*) (in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x55B9D29:
WebCore::FontFallbackList::fontDataAt(WebCore::Font const*, unsigned
int) const (in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x55B45E1: WebCore::Font::floatWidth(WebCore::TextRun
const&, WTF::HashSet<WebCore::SimpleFontData const*,
WTF::PtrHash<WebCore::SimpleFontData const*>,
WTF::HashTraits<WebCore::SimpleFontData const*> >*,
WebCore::GlyphOverflow*) const (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x5663295:
WebCore::RenderImage::setImageSizeForAltText(WebCore::CachedImage*)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x543BF73: WTF::PassRefPtr<WebCore::Element>
WebCore::HTMLConstructionSite::attach<WebCore::Element>(WebCore::Node*,
WTF::PassRefPtr<WebCore::Element>) (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x543B065:
WebCore::HTMLConstructionSite::attachToCurrent(WTF::PassRefPtr<WebCore::Element>)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x543B0B9:
WebCore::HTMLConstructionSite::insertSelfClosingHTMLElement(WebCore::AtomicHTMLToken&)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x542678E:
WebCore::HTMLTreeBuilder::processStartTagForInBody(WebCore::AtomicHTMLToken&)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x5427675:
WebCore::HTMLTreeBuilder::processStartTag(WebCore::AtomicHTMLToken&)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x542BAD2:
WebCore::HTMLTreeBuilder::constructTreeFromToken(WebCore::HTMLToken&)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x541D731:
WebCore::HTMLDocumentParser::pumpTokenizer(WebCore::HTMLDocumentParser::SynchronousMode)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x541DDB9:
WebCore::HTMLDocumentParser::append(WebCore::SegmentedString const&)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x53079BE:
WebCore::DecodedDataDocumentParser::appendBytes(WebCore::DocumentWriter*,
char const*, int, bool) (in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x58AA038:
WebKit::FrameLoaderClient::committedLoad(WebCore::DocumentLoader*,
char const*, int) (in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x54DF4C3: WebCore::DocumentLoader::commitLoad(char
const*, int) (in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x551A75E: WebCore::ResourceLoader::didReceiveData(char
const*, int, long long, bool) (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x550BBC4:
WebCore::MainResourceLoader::didReceiveData(char const*, int, long
long, bool) (in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x550E357:
WebCore::MainResourceLoader::continueAfterContentPolicy(WebCore::PolicyAction,
WebCore::ResourceResponse const&) (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x550E545:
WebCore::MainResourceLoader::continueAfterContentPolicy(WebCore::PolicyAction)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x550EEF8:
WebCore::MainResourceLoader::didReceiveResponse(WebCore::ResourceResponse
const&) (in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x550D0CA:
WebCore::MainResourceLoader::handleDataLoadNow(WebCore::Timer<WebCore::MainResourceLoader>*)
(in /usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x55AC7E5:
WebCore::ThreadTimers::sharedTimerFiredInternal() (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x587F6F1: WebCore::timeout_cb(void*) (in
/usr/local/lib/libwebkitgtk-1.0.so.0.0.1)
==3860== by 0x8CFB09A: ??? (in /lib/libglib-2.0.so.0.2400.1)
==3860== by 0x8CFA8C1: g_main_context_dispatch (in
/lib/libglib-2.0.so.0.2400.1)
==3860== by 0x8CFE747: ??? (in /lib/libglib-2.0.so.0.2400.1)
==3860== by 0x8CFA8C1: g_main_context_dispatch (in
/lib/libglib-2.0.so.0.2400.1)
==3860== by 0x8CFE747: ??? (in /lib/libglib-2.0.so.0.2400.1)
==3860== by 0x8CFEC54: g_main_loop_run (in /lib/libglib-2.0.so.0.2400.1)
==3860== by 0x4065B8: main (domtest.cpp:125)
----------------------------------
The test programme like this:
typedef struct
{
WebKitWebView* webView;
GMainLoop* loop;
}Fixture;
int main()
{
// retrieval files from dirctory
vector<string> files;
string dir = "htmlfile";
readFiles(files,dir);
string contnet;
// gtk init
g_thread_init(NULL);
gtk_init(NULL,NULL);
fstream is;
// iterator files
for(size_t i = 0; i < files.size() ; ++i)
{
string file = files.at(i);
string tmp = dir;
tmp.append("/");
tmp.append(file);
cout << "Reading file -> " << tmp << endl;
is.open(tmp.c_str());
readFile(file,is); // read file content
is.close();
Fixture* fixture = new Fixture();
// create webView and loop
fixture->webView = WEBKIT_WEB_VIEW (webkit_web_view_new ());
fixture->loop = g_main_loop_new(NULL, TRUE);
g_object_ref_sink(fixture->webView);
webkit_web_view_load_string(WEBKIT_WEB_VIEW
(fixture->webView), file.c_str(), NULL, NULL, NULL);
// run loop
g_idle_add((GSourceFunc)finish_loading, fixture);
g_main_loop_run(fixture->loop);
// get title
WebKitWebView* view = (WebKitWebView*)fixture->webView;
WebKitDOMDocument* document = webkit_web_view_get_dom_document(view);
gchar* title = webkit_dom_document_get_title(document);
std::cout << "TT:" << title << std::endl;
g_free(title);
/////////////////
g_object_unref(fixture->webView);
g_main_loop_unref(fixture->loop);
delete fixture;
}
}
---------------
I use this command to compile the programme
g++ domtest.cpp -g3 -o domtest `pkg-config --cflags --libs webkit-1.0`
--
Don't Grow Old, Grow Up... :-)
More information about the webkit-help
mailing list