* Research:
    + s/aquire/acquire/ :-)

    + Need:
	+ total number of string calls (from KCacheGrind (or a plain dump?))
	+ string ops on XML file load ?
	+ performance regression tests ... [!]
	    + [ need a big list of strings ]
	    + with small pool, with stuffed pool.

Check Kai's numbers:
	http://wiki.services.openoffice.org/wiki/Uno/Binary/Analysis/String_Performance

Q1. - do we have to 'intern' everything ?
    + Ans: no - Java doesn't prolly for good reason.

Q2. - 'reliability' - and a local cache ?
    + Ans: not need to be reliable.

Q3. - 'lifecycle' - hold a ref ?
	+ annotating an 'interned' string - ref. count fair game ?
    + <mmeeks> 2 bits: 1 is a 'static' flag (also a guard against huge /wrap-around ref-counts)
      <mmeeks> and bit 2 is the "is-interned" flag
      <mmeeks> ;-)
      * mmeeks really goes.
      <kr_> you mean least significant, don't you?
      <kr_> sounds fine for me !

Q4. - is OUString only acceptable ?

Q5. - ignore 'long' strings > 1024 chars ?

* Need 1 more atomic operation:
    + 'setBit'  (or atomic Xor I guess)

1st concept:

Current design thoughts:
    + explicit "intern" calls, in hot string spots (?)
	+ "intern" only works for 'small' < page strings.
    + comparison operator optimised for ptr == first.
	+ becomes a more common case.

    + problem:
	+ "how can you tell an 'interned' string"
	    + bit-mask on the length ?
	    + bit-mask on the 'refCount' ?
	    + "static" bit on the 'refCount' ?
	    + store a byte 'cookie' / 'canary' at
	      the end ?
	    + cookie.
	+ OR:
	    + a garbage type impl.
	    	+ small hash ~1 page of entries in
		  'thread private storage'
		+ holds a ref on the strings
	    + when this gets full [ size > N bytes ]
		+ scan for 'ref == 1'
	    + 'old' strings - moved to 'old' list (?)
	    + occasionally scan whole list
	      for 'ref == 1' strings

* What about a 'static-intern' (?) :-)
    + never ref count it ...


* Performance points:
    + charset conversion is -normally- done
      in constructors
	+ we can subvert these ?

static OUString createIntern( sal_Unicode *, sal_Int32 nLength );
static OUString createIntern( sal_Char *, sal_Int32 nLength, rtl_TextEncoding );
static OUString createFromAsciiIntern( sal_Char *, sal_Int32 nLength, rtl_TextEncoding );
	+ makes sense ...


ustring.c:
void SAL_CALL rtl_string2UString( rtl_uString** ppThis,
                                  const sal_Char* pStr,
                                  sal_Int32 nLen,
                                  rtl_TextEncoding eTextEncoding,
                                  sal_uInt32 nCvtFlags )

	+ We -could- adapt this to pass an alloca'd "scratch" buffer,
	  and have a more complex calling behavior (and/or duplicate
	  the special cases for _ASCII & _UTF8) & fall-back to a
	  dup/free for others ?


* InterlockedXor (!?)
* InterlockedAnd (!?)
    + do we need interlock on the 'And' ?
	+ can set coming out of the pool lock ?

http://www.gamasutra.com/features/20060630/paquet_01.shtml

* Need a WRITE_BARRIER between lock & a compare ...


* consistency: important,
    + how to update a per-thread cache ?
	+ hold a ref inside the cache ?
	+ if the bit is set ... when we get down to 1 ref ... (?)
	    + transfer it to the main cache & set the bit -only- when out of the per-thead cache ...


TODO:
    hack in the 'sal' CWS ...

* Get a list of all strings allocated / freed at OO.o startup
* Get another list: all strings loading a writer document (?)

* Looking at 'all' strings ...
    + there are a lot [!]
    + 


Static strings:

<kr_> how do I past something here?
<kr_> search for lines with RTL_CONST gave:
<kr_>  String literals found: 20121
<kr_>  Chars in these literals: 321687
<kr_> search for lines with "createFrom" gave:
<kr_>  String literals found: 9676
<kr_>  Chars in these literals: 187719
<kr_> if every strings gets instantiated once, than we have 1018812 ==
1m to save, not counting duplicates ...


gcc - use pre-processor to create in-line static strings,
    + use crack-tastic gcc extensions to do it ...

Charset stuff:
 -fexec-charset 

http://developer.mozilla.org/en/docs/XPCOM_string_guide

The STRING versions of these macros provide a portable way of
declaring UTF-16 versions of the given literal string, avoiding
runtime conversion on platforms which support literal UTF-16 strings
(e.g., MSVC++ and GCC with the -fshort-wchar option).

+ check boost ... (for string literals etc.)


typedef struct {
    int ref;
    int len;
    const wchar_t buffer[4];
} Str;

giveStr(&((const Str) { 12, 3, L"Foo" }));//{ 'f', 'o', 'o' } }));

gcc -O2 -S -std=c99 -Wall -fshort-wchar -fwide-exec-charset=UTF-16 ~/a.c

#define DECL_STR(a) \
    ((Str *)(&((const struct { int r; int l; const wchar_t b[strlen(a) + 1]; } ) { (1<<30)+1, strlen(a), L##a })))

-fshort-wchar is sufficient ...
In fact -fwide-exec-charset=UTF16 - breaks stuff ...

TODO:
    + remove interned strings on destruction
      from the pool ...
    + add primes for hash sizes ...
    + add debug to show pool size / re-size.
    + beef up the regression tests & make it
      resize the pool more frequently.

    + next - beef up offapi/xmlkywd.hxx:
	+ lame-ass code ...
	+ better to export rtl_uStrings I think.


* FIXME:
    + remove generic foo ...

Reply to Stefan:
    + source/rtl/locale.c: rtl_hashtable_ ...
	+ custom hash table etc.
    + plays havoc with 'unloading' of libaries
	+ 'const' strings - can potentially be -very- long lived.
	+ some modules: heavy string users / use for comparison ?

    + file bug: interlck.h:
	@return The result of the operation is zero, the value of the count variable.
    + should be the 'new value of the count' ...

    + Nasty:
	+ freeing rtl_str_hash_intern (in error)


    + add an OUStringBuffer: 'intern'
	+ 'intern' target sites:
	    + 


Strings to catch: (HIT_STR)
    NoName    
    calc_pdf_Export
"<tab><</PageSize [279 540] /ImagingBBox null>> setpagedevice"
    Impress 8
    OnPrint
    com.sun.star.office.comp.SplashScreen
    LabelType
    $1
    Bold

    draw8_template
    .uno:ExtendedHelp



* Archetypes:
--------------------------------------------------------------------------------
HIT_STR=.uno:ExtendedHelp
--------------------------------------------------------------------------------

* 1st: UI code:

#11 0xa1b22479 in framework::MenuConfiguration::CreateMenuBarConfigurationFromXML () from ./libfwe680li.so
-> menudocumenthandler.cxx:
    ExtractMenuParameters: '.intern' on rCommandURL ...

* 3rd: UI code:
#13 0xa1b2cdc3 in framework::ToolBoxConfiguration::LoadToolBox () from ./libfwe680li.so
-> toolboxdocumenthandler.cxx
    ExtractToolbarParameters.cxx '.intern()' on rCommandURL

* 2nd : configmgr
    + intern -all- configmgr keys ? :-) (?)

* 3 incidences:

#10 0xa178436a in framework::URLTransformer::parseStrict () at /opt/OpenOffice/OOE680_m6/solver/680/unxlngi6.pro/inc/com/sun/star/uno/Reference.h:293

	aURL.Complete	= aParser.GetMainURL( INetURLObject::NO_DECODE           );
+                aURL.Complete   = aURL.Complete.intern();

	aParser.SetMark	( OUString() );


[ real component use ]:
--------------------------------------------------------------------------------
HIT_STR=com.sun.star.ucb.SimpleFileAccess
--------------------------------------------------------------------------------

#0  0xb6f95c06 in fscanf () from /lib/libc.so.6
#1  0xb759aa20 in checkString () from ./libuno_sal.so.3
#2  0xb7d7aa77 in rtl::OUString::createFromAscii () from ./libvcl680li.so
#3  0xb7dcc44e in ImplImageTree::implInit () from ./libvcl680li.so
#4  0xb7dcca04 in ImplImageTree::loadImage () from ./libvcl680li.so
#5  0xb7d9f4a1 in BitmapEx::BitmapEx () from ./libvcl680li.so
#6  0xb662410a in GtkSalFrame::SetIcon () from ./libvclplug_gtk680li.so
#7  0xb661ff2b in GtkSalFrame::InitCommon () from ./libvclplug_gtk680li.so
#8  0xb6620363 in GtkSalFrame::Init () from ./libvclplug_gtk680li.so
#9  0xb66232af in GtkSalFrame::GtkSalFrame () from ./libvclplug_gtk680li.so
#10 0xb6604a82 in GtkInstance::CreateFrame () from ./libvclplug_gtk680li.so
#11 0xb7ee8e39 in Window::ImplInit () from ./libvcl680li.so
#12 0xb7e84c2a in ImplBorderWindow::ImplInit () from ./libvcl680li.so
#13 0xb7e84d46 in ImplBorderWindow::ImplBorderWindow () from ./libvcl680li.so
#14 0xb7ef5eb2 in WorkWindow::ImplInit () from ./libvcl680li.so
#15 0xb7e9f2fa in IntroWindow::IntroWindow () from ./libvcl680li.so
#16 0xa2b9943c in desktop::SplashScreen::SplashScreen () from ./libspl680li.so

#0  0xb6f95c06 in fscanf () from /lib/libc.so.6
#1  0xb759aa20 in checkString () from ./libuno_sal.so.3
#2  0xb759b709 in rtl_uString_newFromStr_WithLength () from ./libuno_sal.so.3
#3  0xa4a34025 in rtl::OUString::copy () from ./libreg.so.3
#4  0xa4a2fbf1 in ORegistry::openKeyWithoutLink () from ./libreg.so.3
#5  0xa4a3188d in ORegistry::openKey () from ./libreg.so.3
#6  0xa4a3841f in ORegKey::openKey () from ./libreg.so.3
#7  0xa4a36186 in openKey () from ./libreg.so.3
#8  0xa49ecac9 in RegistryKey::openKey () from /opt/HHInstall/program/simplereg.uno.so
#9  0xa49eaae1 in stoc_simreg::RegistryKeyImpl::openKey () from /opt/HHInstall/program/simplereg.uno.so
#10 0xa49f9f06 in stoc_smgr::retrieveAsciiValueList () from /opt/HHInstall/program/servicemgr.uno.so
#11 0xa49fa06a in stoc_smgr::ORegistryServiceManager::getFromServiceName () from /opt/HHInstall/program/servicemgr.uno.so
#12 0xa49fcbcd in stoc_smgr::ORegistryServiceManager::loadWithServiceName () from /opt/HHInstall/program/servicemgr.uno.so
#13 0xa49fd46e in stoc_smgr::ORegistryServiceManager::queryServiceFactories () from /opt/HHInstall/program/servicemgr.uno.so
#14 0xa49fcf53 in stoc_smgr::OServiceManager::createInstanceWithContext () from /opt/HHInstall/program/servicemgr.uno.so
#15 0xa49fbb73 in stoc_smgr::OServiceManager::createInstance () from /opt/HHInstall/program/servicemgr.uno.so
#16 0xb7dcc459 in ImplImageTree::implInit () from ./libvcl680li.so

#0  0xb6f95c06 in fscanf () from /lib/libc.so.6
#1  0xb7598d1c in checkString () from ./libuno_sal.so.3
#2  0xb759970e in rtl_impl_convertUStringToString () from ./libuno_sal.so.3
#3  0xb7599777 in rtl_uString2String () from ./libuno_sal.so.3
#4  0xa4a15bb8 in rtl::OString::OString () from ./libstore.so.3
#5  0xa4a1c8b7 in store::OStoreDirectory::create () from ./libstore.so.3
#6  0xa4a225f2 in store_openDirectory () from ./libstore.so.3
#7  0xa4a337f0 in store::OStoreDirectory::create () from ./libreg.so.3
#8  0xa4a2fc89 in ORegistry::openKeyWithoutLink () from ./libreg.so.3
#9  0xa4a3188d in ORegistry::openKey () from ./libreg.so.3
#10 0xa4a3841f in ORegKey::openKey () from ./libreg.so.3
#11 0xa4a36186 in openKey () from ./libreg.so.3
#12 0xa49ecac9 in RegistryKey::openKey () from /opt/HHInstall/program/simplereg.uno.so
#13 0xa49eaae1 in stoc_simreg::RegistryKeyImpl::openKey () from /opt/HHInstall/program/simplereg.uno.so
#14 0xa49f9f06 in stoc_smgr::retrieveAsciiValueList () from /opt/HHInstall/program/servicemgr.uno.so
#15 0xa49fa06a in stoc_smgr::ORegistryServiceManager::getFromServiceName () from /opt/HHInstall/program/servicemgr.uno.so

#0  0xb6f95c06 in fscanf () from /lib/libc.so.6
#1  0xb759aa20 in checkString () from ./libuno_sal.so.3
#2  0xb759b868 in rtl_uString_newFromStr () from ./libuno_sal.so.3
#3  0xa4a346fc in rtl::OUString::OUString () from ./libreg.so.3
#4  0xa4a3a72a in ORegKey::getKeyNames () from ./libreg.so.3
#5  0xa4a362d1 in getKeyNames () from ./libreg.so.3
#6  0xa49ec7a0 in RegistryKey::getKeyNames () from /opt/HHInstall/program/simplereg.uno.so
#7  0xa49e722a in stoc_simreg::RegistryKeyImpl::getKeyNames () from /opt/HHInstall/program/simplereg.uno.so
#8  0xb7612943 in cppu::createSingleFactory () from ./libuno_cppuhelpergcc3.so.3
#9  0xa49fc808 in stoc_smgr::OServiceManager::insert () from /opt/HHInstall/program/servicemgr.uno.so
#10 0xa49fcac1 in stoc_smgr::ORegistryServiceManager::loadWithImplementationName () from /opt/HHInstall/program/servicemgr.uno.so
#11 0xa49fcbf0 in stoc_smgr::ORegistryServiceManager::loadWithServiceName () from /opt/HHInstall/program/servicemgr.uno.so
#12 0xa49fd46e in stoc_smgr::ORegistryServiceManager::queryServiceFactories () from /opt/HHInstall/program/servicemgr.uno.so
#13 0xa49fcf53 in stoc_smgr::OServiceManager::createInstanceWithContext () from /opt/HHInstall/program/servicemgr.uno.so
#14 0xa49fbb73 in stoc_smgr::OServiceManager::createInstance () from /opt/HHInstall/program/servicemgr.uno.so
#15 0xb7dcc459 in ImplImageTree::implInit () from ./libvcl680li.so

#0  0xb6f95c06 in fscanf () from /lib/libc.so.6
#1  0xb759aa20 in checkString () from ./libuno_sal.so.3
#2  0xb759b709 in rtl_uString_newFromStr_WithLength () from ./libuno_sal.so.3
#3  0xb7602a01 in cppu::createRegistryServiceFactory () from ./libuno_cppuhelpergcc3.so.3
#4  0xb7612965 in cppu::createSingleFactory () from ./libuno_cppuhelpergcc3.so.3
#5  0xa49fc808 in stoc_smgr::OServiceManager::insert () from /opt/HHInstall/program/servicemgr.uno.so
#6  0xa49fcac1 in stoc_smgr::ORegistryServiceManager::loadWithImplementationName () from /opt/HHInstall/program/servicemgr.uno.so
#7  0xa49fcbf0 in stoc_smgr::ORegistryServiceManager::loadWithServiceName () from /opt/HHInstall/program/servicemgr.uno.so
#8  0xa49fd46e in stoc_smgr::ORegistryServiceManager::queryServiceFactories () from /opt/HHInstall/program/servicemgr.uno.so
#9  0xa49fcf53 in stoc_smgr::OServiceManager::createInstanceWithContext () from /opt/HHInstall/program/servicemgr.uno.so
#10 0xa49fbb73 in stoc_smgr::OServiceManager::createInstance () from /opt/HHInstall/program/servicemgr.uno.so
#11 0xb7dcc459 in ImplImageTree::implInit () from ./libvcl680li.so
#12 0xb7dcca04 in ImplImageTree::loadImage () from ./libvcl680li.so
#13 0xb7d9f4a1 in BitmapEx::BitmapEx () from ./libvcl680li.so
#14 0xb662410a in GtkSalFrame::SetIcon () from ./libvclplug_gtk680li.so
#15 0xb661ff2b in GtkSalFrame::InitCommon () from ./libvclplug_gtk680li.so
#16 0xb6620363 in GtkSalFrame::Init () from ./libvclplug_gtk680li.so
#17 0xb66232af in GtkSalFrame::GtkSalFrame () from ./libvclplug_gtk680li.so

#0  0xb6f95c06 in fscanf () from /lib/libc.so.6
#1  0xb759aa20 in checkString () from ./libuno_sal.so.3
#2  0xa2ad3a91 in rtl::OUString::createFromAscii () from ./libfileacc.so
#3  0xa2ace92a in io_FileAccess::FileAccess_getSupportedServiceNames () from ./libfileacc.so
#4  0xa2ad02ad in component_getFactory () from ./libfileacc.so
#5  0xb761a332 in cppu::loadSharedLibComponentFactory () from ./libuno_cppuhelpergcc3.so.3
#6  0xb5da2080 in stoc_loader::DllComponentLoader::activate () from /opt/HHInstall/program/shlibloader.uno.so
#7  0xb76119bd in cppu::createSingleFactory () from ./libuno_cppuhelpergcc3.so.3
#8  0xb7611e8a in cppu::createSingleFactory () from ./libuno_cppuhelpergcc3.so.3
#9  0xb761123d in cppu::createSingleFactory () from ./libuno_cppuhelpergcc3.so.3
#10 0xb7611311 in cppu::createSingleFactory () from ./libuno_cppuhelpergcc3.so.3
#11 0xa49fcf9c in stoc_smgr::OServiceManager::createInstanceWithContext () from /opt/HHInstall/program/servicemgr.uno.so
#12 0xa49fbb73 in stoc_smgr::OServiceManager::createInstance () from /opt/HHInstall/program/servicemgr.uno.so
#13 0xb7dcc459 in ImplImageTree::implInit () from ./libvcl680li.so
#14 0xb7dcca04 in ImplImageTree::loadImage () from ./libvcl680li.so
#15 0xb7d9f4a1 in BitmapEx::BitmapEx () from ./libvcl680li.so
#16 0xb662410a in GtkSalFrame::SetIcon () from ./libvclplug_gtk680li.so

#0  0xb6f95c06 in fscanf () from /lib/libc.so.6
#1  0xb759aa20 in checkString () from ./libuno_sal.so.3
#2  0xb7d7aa77 in rtl::OUString::createFromAscii () from ./libvcl680li.so
#3  0xb7dcc44e in ImplImageTree::implInit () from ./libvcl680li.so
#4  0xb7dcca04 in ImplImageTree::loadImage () from ./libvcl680li.so
#5  0xb7d9f4a1 in BitmapEx::BitmapEx () from ./libvcl680li.so
#6  0xb662410a in GtkSalFrame::SetIcon () from ./libvclplug_gtk680li.so
#7  0xb661ff2b in GtkSalFrame::InitCommon () from ./libvclplug_gtk680li.so
#8  0xb6620363 in GtkSalFrame::Init () from ./libvclplug_gtk680li.so
#9  0xb66232af in GtkSalFrame::GtkSalFrame () from ./libvclplug_gtk680li.so
#10 0xb6604a82 in GtkInstance::CreateFrame () from ./libvclplug_gtk680li.so
#11 0xb7ee8e39 in Window::ImplInit () from ./libvcl680li.so
#12 0xb7e84c2a in ImplBorderWindow::ImplInit () from ./libvcl680li.so
#13 0xb7e84d46 in ImplBorderWindow::ImplBorderWindow () from ./libvcl680li.so
#14 0xb7ef5eb2 in WorkWindow::ImplInit () from ./libvcl680li.so
#15 0xb7e9f2fa in IntroWindow::IntroWindow () from ./libvcl680li.so
#16 0xa2b9943c in desktop::SplashScreen::SplashScreen () from ./libspl680li.so

#0  0xb6f95c06 in fscanf () from /lib/libc.so.6
#1  0xb759aa20 in checkString () from ./libuno_sal.so.3
#2  0xb7d7aa77 in rtl::OUString::createFromAscii () from ./libvcl680li.so
#3  0xb7dcc44e in ImplImageTree::implInit () from ./libvcl680li.so
#4  0xb7dcca04 in ImplImageTree::loadImage () from ./libvcl680li.so
#5  0xb7d9f4a1 in BitmapEx::BitmapEx () from ./libvcl680li.so
#6  0xb662410a in GtkSalFrame::SetIcon () from ./libvclplug_gtk680li.so
#7  0xb661ff2b in GtkSalFrame::InitCommon () from ./libvclplug_gtk680li.so
#8  0xb6620363 in GtkSalFrame::Init () from ./libvclplug_gtk680li.so
#9  0xb66232af in GtkSalFrame::GtkSalFrame () from ./libvclplug_gtk680li.so
#10 0xb6604a82 in GtkInstance::CreateFrame () from ./libvclplug_gtk680li.so
#11 0xb7ee8e39 in Window::ImplInit () from ./libvcl680li.so
#12 0xb7e8eb0a in Dialog::ImplInit () from ./libvcl680li.so
#13 0xb7e8f708 in ModalDialog::ModalDialog () from ./libvcl680li.so
#14 0xb7a68259 in WizardDialog::WizardDialog () from ./libsvt680li.so
#15 0xb7a49162 in svt::OWizardMachine::OWizardMachine () from ./libsvt680li.so
#16 0xb7a46660 in svt::RoadmapWizard::RoadmapWizard () from ./libsvt680li.so
#17 0xa2ba4029 in desktop::FirstStartWizard::FirstStartWizard () from ./libspl680li.so
#18 0xa2b9aebb in desktop::FirstStart::execute () from ./libspl680li.so
#19 0x0806d3a0 in desktop::Desktop::Main ()


--------------------------------------------------------------------------------
HIT_STR=draw8_template
--------------------------------------------------------------------------------

5x - every time - coming from the configmgr: ...
    + just a -lot- of duplicates in the XML ;-) [neat]

(gdb) bt
#0  0xb6edac06 in fscanf () from /lib/libc.so.6
#1  0xb74dfa20 in checkString () from ./libuno_sal.so.3
#2  0xb74e0450 in rtl_string2UString () from ./libuno_sal.so.3
#3  0xa3c885f4 in configmgr::backend::BinaryReader_Impl::readUTF () from ./configmgr2.uno.so
#4  0xa3c890b1 in configmgr::backend::BinaryReader::read () from ./configmgr2.uno.so
#5  0xa3c8d513 in configmgr::backend::readAsAny<rtl::OUString> () from ./configmgr2.uno.so
#6  0xa3c8bcaa in configmgr::backend::BinaryReadHandler::readValue () from ./configmgr2.uno.so
#7  0xa3c8c9ea in configmgr::backend::BinaryReadHandler::readChildren () from ./configmgr2.uno.so
#8  0xa3c8c799 in configmgr::backend::BinaryReadHandler::readChildren () from ./configmgr2.uno.so
#9  0xa3c8c8cd in configmgr::backend::BinaryReadHandler::readChildren () from ./configmgr2.uno.so
#10 0xa3c8c799 in configmgr::backend::BinaryReadHandler::readChildren () from ./configmgr2.uno.so
#11 0xa3c8cda7 in configmgr::backend::BinaryReadHandler::readToplevelTree () from ./configmgr2.uno.so
#12 0xa3c8cecb in configmgr::backend::BinaryReadHandler::readComponentTree () from ./configmgr2.uno.so
#13 0xa3c8dbe0 in configmgr::backend::BinaryCache::readComponentData () from ./configmgr2.uno.so
#14 0xa3c7f384 in configmgr::backend::BackendAccess::readDefaultData () from ./configmgr2.uno.so
#15 0xa3c7f7cb in configmgr::backend::BackendAccess::getNodeData () from ./configmgr2.uno.so
#16 0xa3c4ad97 in configmgr::backend::CacheController::loadDirectly () from ./configmgr2.uno.so
#17 0xa3c4afa7 in configmgr::backend::CacheController::loadComponent () from ./configmgr2.uno.so


** We need to implement internConvert - & intern all utf8 strings ... [IMHO]

--------------------------------------------------------------------------------
HIT_STR=org.openoffice.Office.Substitution
--------------------------------------------------------------------------------

#0  0xb6f05c06 in fscanf () from /lib/libc.so.6
#1  0xb750aa20 in checkString () from ./libuno_sal.so.3
#2  0xb750b709 in rtl_uString_newFromStr_WithLength () from ./libuno_sal.so.3
#3  0xa3c8f8e9 in rtl::OUString::OUString () from ./configmgr2.uno.so
#4  0xa3ce964e in configmgr::configuration::(anonymous namespace)::implParsePath () from ./configmgr2.uno.so
#5  0xa3ce97ed in configmgr::configuration::AbsolutePath::parse () from ./configmgr2.uno.so
#6  0xa3d15a1e in configmgr::OProviderImpl::buildUpdateAccess () from ./configmgr2.uno.so
#7  0xa3d19241 in configmgr::OConfigurationProviderImpl::createUpdateAccess () from ./configmgr2.uno.so
#8  0xa3d18175 in configmgr::OConfigurationProvider::createInstanceWithArguments () from ./configmgr2.uno.so
#9  0xb77e84ea in utl::ConfigManager::AcquireTree () from ./libutl680li.so
#10 0xb77e8dd2 in utl::ConfigManager::AddConfigItem () from ./libutl680li.so
#11 0xb77e4e47 in utl::ConfigItem::ConfigItem () from ./libutl680li.so
#12 0xa2a8da72 in framework::SubstitutePathVariables_Impl::SubstitutePathVariables_Impl () from ./libfwl680li.so
#13 0xa2a90561 in framework::SubstitutePathVariables::SubstitutePathVariables () from ./libfwl680li.so
#14 0xa2a908c1 in framework::SubstitutePathVariables::impl_createInstance () from ./libfwl680li.so
#15 0xb758151c in cppu::createSingleFactory () from ./libuno_cppuhelpergcc3.so.3
#16 0xb758123d in cppu::createSingleFactory () from ./libuno_cppuhelpergcc3.so.3

2,3,4,5 - configmgr:

#0  0xb6f05c06 in fscanf () from /lib/libc.so.6
#1  0xb750aa20 in checkString () from ./libuno_sal.so.3
#2  0xb750b450 in rtl_string2UString () from ./libuno_sal.so.3
#3  0xa3cb35f4 in configmgr::backend::BinaryReader_Impl::readUTF () from ./configmgr2.uno.so
#4  0xa3cb40b1 in configmgr::backend::BinaryReader::read () from ./configmgr2.uno.so
#5  0xa3cb7323 in configmgr::backend::BinaryReadHandler::verifyFileHeader () from ./configmgr2.uno.so
#6  0xa3cb7464 in configmgr::backend::BinaryReadHandler::validateHeader () from ./configmgr2.uno.so
#7  0xa3cb8bc4 in configmgr::backend::BinaryCache::readComponentData () from ./configmgr2.uno.so
#8  0xa3caa384 in configmgr::backend::BackendAccess::readDefaultData () from ./configmgr2.uno.so
#9  0xa3caa7cb in configmgr::backend::BackendAccess::getNodeData () from ./configmgr2.uno.so
#10 0xa3c75d97 in configmgr::backend::CacheController::loadDirectly () from ./configmgr2.uno.so


--------------------------------------------------------------------------------
HIT_STR=res/commandimagelist/lc_underline.png
--------------------------------------------------------------------------------

* trivial to fix ...

(gdb) bt
#0  0xb6eaec06 in fscanf () from /lib/libc.so.6
#1  0xb74b3a20 in checkString () from ./libuno_sal.so.3
#2  0xb74b4450 in rtl_string2UString () from ./libuno_sal.so.3
#3  0xa2a36cfe in rtl::OUString::OUString () from ./libpackage2.so
#4  0xa2a34c46 in ZipFile::readCEN () from ./libpackage2.so
#5  0xa2a3523f in ZipFile::ZipFile () from ./libpackage2.so
#6  0xa2a50ca6 in OZipFileAccess::initialize () from ./libpackage2.so
#7  0xb7ce5544 in ImplImageTree::implInit () from ./libvcl680li.so
#8  0xb7ce5a04 in ImplImageTree::loadImage () from ./libvcl680li.so
#9  0xb7cb84a1 in BitmapEx::BitmapEx () from ./libvcl680li.so
#10 0xb653d10a in GtkSalFrame::SetIcon () from ./libvclplug_gtk680li.so
#11 0xb6538f2b in GtkSalFrame::InitCommon () from ./libvclplug_gtk680li.so
#12 0xb6539363 in GtkSalFrame::Init () from ./libvclplug_gtk680li.so
#13 0xb653c2af in GtkSalFrame::GtkSalFrame () from ./libvclplug_gtk680li.so
#14 0xb651da82 in GtkInstance::CreateFrame () from ./libvclplug_gtk680li.so
#15 0xb7e01e39 in Window::ImplInit () from ./libvcl680li.so
#16 0xb7da7b0a in Dialog::ImplInit () from ./libvcl680li.so
#17 0xb7da8708 in ModalDialog::ModalDialog () from ./libvcl680li.so
#18 0xb7981259 in WizardDialog::WizardDialog () from ./libsvt680li.so
#19 0xb7962162 in svt::OWizardMachine::OWizardMachine () from ./libsvt680li.so
#20 0xb795f660 in svt::RoadmapWizard::RoadmapWizard () from ./libsvt680li.so
#21 0xa2a96029 in desktop::FirstStartWizard::FirstStartWizard () from ./libspl680li.so
#22 0xa2a8cebb in desktop::FirstStart::execute () from ./libspl680li.so
#23 0x0806d3a0 in desktop::Desktop::Main ()
#24 0xb7c9b3eb in ImplSVMain () from ./libvcl680li.so
#25 0xb7c9b501 in SVMain () from ./libvcl680li.so
#26 0x080646db in sal_main ()
#27 0x08064730 in main ()

1hit: vcl impimagetree hash.

1 hit resmgr:

#0  0xb6d30c06 in fscanf () from /lib/libc.so.6
#1  0xb733e5fa in checkString () from ./libuno_sal.so.3
#2  0xb733f09c in rtl_string2UString () from ./libuno_sal.so.3
#3  0xb76f6748 in String::String () from ./libtl680li.so
#4  0xb7723459 in ResMgr::GetStringWithoutHook () from ./libtl680li.so
#5  0xb7725996 in ResMgr::ReadStringWithoutHook () from ./libtl680li.so
#6  0xb7725a1e in ResMgr::ReadString () from ./libtl680li.so
#7  0xb7ccf270 in ImageList::ImageList () from ./libvcl680li.so
#8  0xb78a946f in GetImageFromList_Impl () from ./libsvt680li.so
#9  0xb78aab8e in SvFileInformationManager::GetImageNoDefault () from ./libsvt680li.so
#10 0xa1aa172d in SfxAppToolBoxControl_Impl::SetImage () from ./libsfx680li.so
#11 0xa1aa2d66 in SfxAppToolBoxControl_Impl::SfxAppToolBoxControl_Impl () from ./libsfx680li.so
#12 0xa1aa2dea in SfxAppToolBoxControl_Impl::CreateImpl () from ./libsfx680li.so
#13 0xa1aa52d8 in SfxToolBoxControl::CreateControl () from ./libsfx680li.so
#14 0xa1aa5602 in SfxToolBoxControllerFactory () from ./libsfx680li.so

--------------------------------------------------------------------------------
HIT_STR=Regular
--------------------------------------------------------------------------------

#0  0xb6e0ec06 in fscanf () from /lib/libc.so.6
#1  0xb741c5fa in checkString () from ./libuno_sal.so.3
#2  0xb741d09c in rtl_string2UString () from ./libuno_sal.so.3
#3  0xb6afa2be in rtl::OUString::OUString () from ./libpsp680li.so
#4  0xb6afed2a in psp::FontCache::read () from ./libpsp680li.so
#5  0xb6afefa2 in psp::FontCache::FontCache () from ./libpsp680li.so
#6  0xb6aec465 in psp::PrintFontManager::initialize () from ./libpsp680li.so
#7  0xb6aed740 in psp::PrintFontManager::get () from ./libpsp680li.so



* Measurement:

    + add all the 'interns' ...
	+ then disable 'intern' ;-)


pmap `ps ax | grep soffice.bin | grep -v grep | cut -f 2 -d ' '` | grep writable
before:
71196K writable-private, 88220K readonly-private, and 286440K shared
71176K writable-private, 88220K readonly-private, and 286440K shared
71172K writable-private, 88220K readonly-private, and 286440K shared

hash size 29503


after:
70688K writable-private, 88220K readonly-private, and 286440K shared
70688K writable-private, 88220K readonly-private, and 286440K shared
70616K writable-private, 88220K readonly-private, and 286440K shared

hash size 21050

* Saved another 600Kb ...
    + check how much the (stupid) STL::hash wastes of that (!?)
	+ allocation overhead, silly hash arrangement etc.

* Checking vs. new uniqued string dump
    + only ~120kb left (of duplicates)
	    + ie. small change.
	    + shrink the hash (!?)

    + test vs. smaller hash foo (!)
	+ re-profile without the g_hash_table foo (?)
	    + [ may magnify the delta ]