Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I was looking at memory usage and noticed OUString::intern being used
in ZipFile::readCEN. This was introduced a long time ago, so I was
wondering if it is still beneficial:

commit f86cafc3c7baab6f08263e4550dffa26f51811bc
Author: RĂ¼diger Timm <rt@openoffice.org>
Date:   Tue Apr 3 13:08:01 2007 +0000

    INTEGRATION: CWS salstrintern (1.45.28); FILE MERGED
    2007/02/08 14:23:59 mmeeks 1.45.28.1: Issue number: i#74343
    Submitted by: mmeeks
    'intern' all ZipFile stream name strings - they're duplicated elsewhere.

I couldn't immediately find the duplication of the names.
In this case the strings are the full zip file entry paths. e.g.
"sw/res/sidebar/pageproppanel/portraitcopy_24x24.png"
And as far as I can see all the full path names are unique, so no
actual sharing is taking place here. But is there a place where these
strings are reused (and also interned)?

Replacing the intern with a normal OUString constructor like:

--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -847,7 +847,7 @@ sal_Int32 ZipFile::readCEN()
                 throw ZipException("unexpected extra header info length", uno::Reference < 
XInterface > () );
 
             // read always in UTF8, some tools seem not to set UTF8 bit
-            aEntry.sPath = OUString::intern ( (sal_Char *) aMemGrabber.getCurrentPos(),
+            aEntry.sPath = OUString ( (sal_Char *) aMemGrabber.getCurrentPos(),
                                                    aEntry.nPathLen,
                                                    RTL_TEXTENCODING_UTF8 );

Seems to save ~200K of memory at least for a quick:

export OOO_EXIT_POST_STARTUP=1
export OOO_DISABLE_RECOVERY=1
install/program/soffice --valgrind --writer

But that might be too quick to see any effects of this intern action.
I cannot immediately find with which other string intern action this
is/should be paired to see memory savings.

So I guess my general question is how to measure the effects of
OUString::intern?

Thanks,

Mark

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.