** More re-factoring TODOs:

    + remove IConfigBroadcaster - only 1 sub-class
	ConfigChangeBroadcaster [!?]

** older material:

+ interlocked foo ..
    + salhelper::SimpleReferenceObject
    + bin 'simplereferenceobject.hxx' includes (?)
+ kill memory-segment foo ...
+ kill cacheline accessor bits 

+ back-port:
    + commit ...

+ add locking to the 'idle writer' [thing...]
+ next slow thing:
    + the binary cache reading thing [urgh]
	+ string reduction foo ...


** Warning Free Build ** [!?:-]

+ profiling:
    + string / isNamed optimisation
    + implMakeNormalizedPredicate:
	+ pre-scan to avoid allocation / duplication (?)
	+ what is the common case ?

    + we call 'implMakeCompositeName'
	then  'implSplitCompositeName' - in short sequence ...
	    + tons of extra allocation & pain ;-) [ why ? ]

+ this is calling 'getElementNames' ... [ how can it be so slow ? ;-]
    + the 'ElementTree' sub-class needs to be cleverer [!]

2 - SetVisitorAdaptor::visit
3 - CollectNodeNames::handle
4 - Tree::getName
5 - TreeImpl::getSimpleNodeName
6 - TreeImpl::getSimpleRootName
    Name TreeImpl::getSimpleRootName() const
    {
	return doGetRootName().getName();
    }
	-> configpath.cxx (Component::getName):
	    Name Component::getName()    const SAL_THROW(())
	    {
		if (isSimpleName()) return m_aName;

		OUString sName, sType;
		implSplitCompositeName(m_aName,sType,sName);
        
		return Name(sName,PackageOnly());
	    }
	-> [ URGH !? ;-]

7 - ElementTreeImpl::doGetRootName
    Path::Component ElementTreeImpl::doGetRootName() const
        { return makeExtendedName( m_aElementName ); }
8 - ElementTreeImpl::makeExtendedName ...
    Path::Component ElementTreeImpl::makeExtendedName(Name const& _aSimpleName) const
    {
	Name aTypeName = implGetOriginalName(root_());
	... grind grind ...


	    CollectPropertyInfo::Result CollectNodeNames::handle(configuration::Tree const& aTree, configuration::NodeRef const& aNode)
	    {
		    m_aList.push_back(aTree.getName(aNode).toString());
		    return CONTINUE;
	    }


+ before:
(per iteration) 0.068004
(per iteration) 0.065609
(per iteration) 0.065594
with Accessor stubbed:
(per iteration) 0.055364
(per iteration) 0.055060
(per iteration) 0.054961

+ remove accessor.hxx ...

+ to debug:
    ENVCFGFLAGS="-me -tiwepd" ./soffice.bin -writer

+ 'OneLock'
    + bin 'Accessor' foo ...
    + 

inc/
attributelist.hxx:69:    virtual sal_Int16 SAL_CALL getLength(void) throw (::com::sun::star::uno::RuntimeException);
bootstrapcontext.hxx:137:                throw (uno::RuntimeException);
bootstrap.hxx:112:            throw (uno::RuntimeException) ;
cacheddataprovider.hxx:204:                The exact exception being thrown may depend on the underlying backend.
configexcept.hxx:125:		WrappedUnoException rethrowWrapped(Except const& anException)
confsvccomponent.hxx:84:		virtual uno::Sequence<sal_Int8> SAL_CALL getImplementationId(  ) throw(uno::RuntimeException);
interactionrequest.hxx:114:            throw( uno::RuntimeException );
mergeddataprovider.hxx:83:            @throws com::sun::star::uno::Exception
oslstream.hxx:85:                throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
propertysethelper.hxx:78:    virtual uno::Any SAL_CALL queryInterface( uno::Type const & rType ) throw (uno::RuntimeException);
serviceinfohelper.hxx:116:            throw(uno::RuntimeException);


api2/
    + ' impl.*' all in these guys:
accessimpl.hxx:85:			throw(uno::RuntimeException);
    + all take 'GuardedNodeDataAccess' ...
        + clobbered that (accessimpl.hxx)
apinotifierimpl.hxx:74:			throw(uno::RuntimeException);
    + uses GuardedNotifier (cf. confignotifier.hxx)
elementimpl.hxx:80:			throw(uno::RuntimeException);
    + some manual extras ...
    + also DisposeGuard -> UnoApiLock (confignotifier.hxx)
    + also GuardedRootElement (apitreeaccess.hxx)
    + also GuardedTreeElement
propsetaccessimpl.hxx:149:			throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
    + GuardedNodeUpdate - also take it ...
    + some explicit ...
providerimpl.hxx:163:                @throws com::sun::star::lang::IllegalArgumentException
    + non-event (?)
updateimpl.hxx:69:			throw(css::lang::IllegalArgumentException, css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException);
    + use existing guards...


+ locked:
    confprovider2.hxx:78:				throw(uno::Exception, uno::RuntimeException);
	+ clobbered
    provider.hxx:135:		virtual uno::Reference< beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(uno::RuntimeException);		
	+ clobbered

    propertiesfilterednotifier.hxx:58:		virtual void SAL_CALL acquire(  ) throw();
    propertyinfohelper.hxx:62:			throw(uno::RuntimeException);
	+ looks ok.

elementaccess.hxx:118:		virtual void SAL_CALL acquire() throw();
groupaccess.hxx:94:				throw(uno::RuntimeException);
groupobjects.hxx:85:		uno::Any SAL_CALL queryInterface( uno::Type const& rType ) throw (uno::RuntimeException );
groupupdate.hxx:68:		uno::Any SAL_CALL queryInterface( uno::Type const& rType ) throw (uno::RuntimeException );
listenercontainer.hxx:170:			 * @throw com::sun::star::lang::DisposedException
propertysetaccess.hxx:103:			throw(uno::RuntimeException);
setaccess.hxx:105:				throw(uno::RuntimeException);
setobjects.hxx:84:		uno::Any SAL_CALL queryInterface( uno::Type const& rType ) throw (uno::RuntimeException );
setupdate.hxx:78:		uno::Any SAL_CALL queryInterface( uno::Type const& rType ) throw (uno::RuntimeException );


+ regression tests:
    // May be there is no type set ...
    if (xCfg->hasByName(TYPES_SET))
	+ called on a 'set' instead of a value ... [!?]


+ treemgr/ - API:
    configpath.cxx:
	+ configuration::Name (oustring), ::Path, 
    configdefaultprovider.cxx
    configexcept.cxx - exceptions
    configgroup.cxx
    configset.cxx
    nodechange.cxx
    nodechangeinfo.cxx
    noderef.cxx
    roottree.cxx
    template.cxx

    + 'viewstrategy' - determines how the view is used ...
    + TreeMgr: evilness:
        + bin evil 'source/treemgr/viewnode.hxx' ...
	    + 'Tree' (Accessor+'TreeData*')



+ Profile:
    + kcachegrind shows lots of time in GroupNodeAccess::implGetChild(Name)...
	+ ~300k calls to 'compare' during writer startup
	+ ViewStrategy's 'getMemberValueAccess' ...
    + a 1 element cache:
	- check the last thing,
	+ the one after [ for linear walks ]
	    + should be easy ... :-)
	+ cf. ~/esc/amd/configmgr-performance.png [!]
	    + should save a -ton- of cycles ...

** TODO:
   + understand how writes to the treecache work ...
	+ api2/propsetaccessimpl.cxx (implSetPropertyValue):
		NodeChange aChange = lock.getNodeUpdater().validateSetValue( aChild, aValue );
		if (aChange.test().isChange())
		{
			Broadcaster aSender(rNode.getNotifier().makeBroadcaster(aChange,true));
			aSender.queryConstraints(aChange);
			aTree.integrate(aChange, aNode, true);
	+ treemgr/noderef.cxx (Tree::integrate):
		aChange.apply();
	+ treemgr/nodechangeimpl.cxx (implApply)
		... -> virtual 'doApply'
	+ treemgr/valuemembernode.cxx (ValueMemberUpdate::setValue)
		+ deferredoperation [or] - 'data::ValueNodeAccess::setValue ...'
	+ tree/valuenodeaccess.cxx
		+ [ just writes directly into sharable::ValueNode ]
   + how does ' SetInsertImpl' work ?
	+ (?) ->
	+ treemgr/viewstrategy.cxx 'ViewStrategy::insertElement' ->
	    'ViewStrategy::doInsertElement' (virtual)
	    -> deferredview, readonlyview, directview ...
	+ treemgr/setnodeimpl.cxx (insertElement)
	    + 'ElementSet::insertElement'
		+ whacks it into a hash: 'ElementSet' ...
	+ treemgr/directview.cxx (doInsertElement):
	+ treemgr/treeimpl.cxx (ElementTreeImpl::attachTo)
        if (memory::Segment * pTargetSpace = getUpdatableSegment(*pOwningTree))
        {
            memory::UpdateAccessor aTargetAccessor(pTargetSpace);

            // copy over to the new segment
            data::TreeAddress aNewElement = m_aOwnData.getTreeAccess().copyTree(aTargetAccessor);
            data::SetNodeAccess::addElement(aOwningSet,  aNewElement);
            data::TreeAccessor aNewAccessor(aTargetAccessor.downgrade(),aNewElement);
            rtl::Reference<view::ViewStrategy> xNewBehavior = pOwningTree->getViewBehavior();
            this->rebuild(xNewBehavior,aNewAccessor,m_aOwnData.getAccessor());
	+ treemgr/setnodeaccess.cxx (SetNodeAccess::addElement)
	    + Just (pre)-pends to linked list [ no memory problems ... ]
** Understand - set removal & holding of references ... [?]
   + all refs by name ?
	+ Only 2 types of change: SetChange & NodeChange ...

   + understand how locking / lifecycle works here ...
	+ [ if at all (!) ]

** Obvious:
+ cleanup:
   'sharable' -> 'shareable' ? 
/data/OpenOffice/ooe680-m2/configmgr/source/tree/builddata.cxx:636: warning: unused parameter ‘_anUpdater’
/data/OpenOffice/ooe680-m2/configmgr/source/data/anydata.cxx:430: warning: unused parameter ‘_anAccessor’
/data/OpenOffice/ooe680-m2/configmgr/source/data/sequence.cxx:384: warning: unused parameter ‘_anAccessor’
/data/OpenOffice/ooe680-m2/configmgr/source/tree/setnodeaccess.cxx:108: warning: unused parameter ‘_aAccessor’

** Next step:
    + Hack cacheline.cxx - m_base storage [etc. !]...

    + Start on the NodeAddress -> NodeAccessor change ?

    + have a drive on removing un-used UpdateAccessors ? [etc.]
	+ have a 'SegmentLock' instead (?)

** understand the treecache
    + grep -R '"cache' source
	+ shows the entry points [!]

    + 'cacheddataprovider.hxx'
	+ seems to be the main lifecycle API
    + cachefactory.hxx: 'createCacheManager'
	+ api2/providerimpl.cxx:
	    + returns a 'TreeManager'
	    + access goes via that API ...
**  + All calls come in via the TreeManager impl ...

    ** TreeManager holds 'CacheData' and also a map of
                         CacheClientAccess -> CacheData

    + When a module is 'dead'
	+ cacheaccess.cxx: CacheLoadingAccess tracks it in m_aDeadModules (2x)
	+ CacheLoadingAccess
	    - rather naughty about tracking the modules
	    - doesn't clean them from the CacheData object.
	+ everyone else is rather good ...
    + What is the relation between CacheLoadingAccess & CacheData ?
	+ is the client ref count critical ?
		+ clientRelease / clientAcquire
		+ CacheLineClientRef - under-used & bogus internal ref.
	+ reference++:
		+ acquireModule, acquireNode, insertDefaults,
		  addTemplates, addComponentData
	+ reference--
		+ releaseModule, 'releasePending' !?, 
	+ Horrific:
		+ acquireModule -> opaque 'address', with no
		  auto-ref-counting semantics.

+ cachecontroller.cxx: [!]
    * Each 'loadComponent' call must have a 'freeComponent' call...
	+ we have 69 'loading component'
	+ and only 43 'releasing module's ... [urk]

+ peeling back to:
    + treemanager.cxx (requestSubtree):
	+ each 'request for subtree' must have matching
    + treemanager.cxx (releaseSubtree):
	+ 'releasing subtree'
**	+ Odd ! - these seem to pair up perfectly ... **
	+ 'aCache->releasenode(...) ?
	+ aCache == CacheClientAccess ...

Leaking 4 trees total (61)
[0001] info (004698):      Discarding CacheData (Still holding 4 module trees)
  entry 'org.openoffice.Office.TypeDetection' (0x82a8d40)
  entry 'org.openoffice.TypeDetection.Filter' (0x82f7588)
  entry 'org.openoffice.TypeDetection.Misc' (0x855da80)
  entry 'org.openoffice.TypeDetection.Types' (0x82a9ff8)

	+ -apparently- both setup with 'addComponentData'
		+ is it a hierarchical thing ?


* Do what Joerg suggests at the bottom:

Notes on configmgr2
      [ why is this so impossibly slow & inefficient ! ]

+ work on patches/test/configmgr-profile.diff:
	+ fixup tree-tests:
		+ act on profile:
		+ it's all the ~Reference<XNameAccess>
			that causes the pain ...

Observations
    + the UNO API mandates that everything must be thread-safe
	+ across 2 adjacent key access everything could change
	+ this is not what anyone wants

    + new API ?
	+ any = getStructure (path, type)
	    + 1 set of locking & iteration (?)
	    + getSubPath:

*** Performance ***
    + ~NotifierImpl - burns 56million instructions
	-> listenercontainer.hxx ...
	invariably has just 1 listener.
	    + created by ApiTreeImpl:
		+ m_aNotifier (new NotifierImpl(aTree))
	    + NotifierImplHolder:
		+ a vos::ORef<NotifierImpl>
		+ [ can it not smart-create ? ]


*** Notes ***

    + 2 types of 'tree' node:
	+ Group - presumably a normal node
	+ Set - presumably a simple list

    + Question:
	+ is it *really* worth screwing around with
	  this design ?
	+ generate some statistics.

*** API ***

**** UNO ****

container::XChild, container::XNamed, lang::XComponent,
configuration::XTemplateInstance, lang::XUnoTunnel
beans::XPropertySet, beans::XMultiPropertySet ...
util::XRefreshable, util::XFlushable, util::XStringEscape

  + source/
    + api2/
	+ elementaccess.hxx:
	    + BasicInnerElement: XChild, XNamed
	    + BasicSetElement: XChild, XNamed, XComponent
			       XTemplateInstance, XUnoTunnel
	    + BasicRootElement: XNamed, XComponent,
				XChangesNotifier, XLocalizable
	    + BasicUpdateelement: BasicRootElement, XChangesBatch
	+ groupaccess.hxx:
	    + BasicGroupAccess: XNameAccess, XHierarchicalName,
				XHierarchicalNameAccess, XContainer,
				XExactName, XProperty
	+ propertysetaccess.hxx:
	    + BasicPropertySet: XPropertySet, XMultiPropertySet,
				XHierarchicalPropertySet,
				XMultiHierarchicalPropertySet,
				XPropertyState, XMultiPropertyStates
	+ provider.hxx:
	    + OProvider: XMultiServiceFactory, XLocalizable,
			 XRefreshable, XFlushable
	+ setaccess.hxx:
	    + BasicSetAccess: XNameAccess, XHierarchicalName,
			      XHierarchicalNameAccess, XContainer,
			      XExactName, XProperty, XPropertySetInfo,
			      XTemplateContainer, XStringEscape

**** api2/configapi layer ****

    This is used by all the UNO wrappers, and features a much simpler
API, works on both NodeGroup & NodeSet node references
[NodeSetInfoAccess eg.]

	+ All operates on:
	    + configuration::Tree references

	+ apinodeaccess.cxx:
	    + makeElement
	    + makeUnoElement
	    + GuardedNodeAccess:
	+ accessimpl.cxx:
	    + implGetByName
		+ takes a GuardedNodeDataAccess lock.

	+ calls into 'configuration' API
	    ::configuration::getChildOrElement
	    ::configuration::validateAndReducePath
	    ::configuration::getDeepDescendant

	+ apifactory.cxx:
	    + configapi::Factory::
		+ makes UNO proxies for things

	+ apifactoryimpl.cxx:
	    + ReadOnlyObjectFactory::doCreateSetElement
		+ creates set elements.

	+ groupobjects.cxx:
	    + OSetElementGroupInfo

	+ apiaccessobj.hxx:
	    + OSetElement
		+ instantiates an ApiTreeImpl

	+ apitreeimplobj.cxx:
	    + ApiTreeImpl::ApiTreeImpl + ::init
	    + adds notifiers & all manner of gubbins

	+ notifierimpl.hxx
	    + 1 member: a SpecialListenerContainer

	+ listenercontainer.cxx
	    + manages XEventListener, XContainerListener,
	      XChangesListener, XPropertyChangeListener,
	      XVetoableChangeListener [etc.]
	      XPropertiesChangeListener
**	    + the vetoing - requires synchronous
	      listening (always?) ... 

	    typedef SpecialListenerContainer <SubNodeID,SubNodeHash,SubNodeEq,SubNodeToIndex> SpecialContainer;
	    ...
	    typedef cppu::OMultiTypeInterfaceContainerHelperVar< Key_,KeyHash_,KeyEq_ >	SpecialContainerHelper;
	    + Slowness via  OBroadcastHelperVar<> m_aSpecialHelper
	    	    + 100 elements ?
		    + default bucket count:
			+ we -usually- only use 1 element so ...

	+ cppuhelper/inc/cppuhelper/interfacecontainer.h
	    + OMultiTypeInterfaceContainerHelper
	    + interesting: can add / remove same thing
	      multiple times [ with a simple ref-count ? ]

	+ since each node has an (allocated) NotifierImpl anyway
	    + why not let the node track listeners itself ?
	    + far easier to find & manage surely ?

	+ what are in these buckets ?
	    + are there 100 buckets to clear (each?)
	    + 36million cycles

	+ NotifierImpl much loved by:
	    + broadcaster.cxx
	    + confignotifier.cxx
	    + apitreeimplobj.cxx

	+ void configmgr::configapi::NotifierImpl::add(const configmgr::configuration::NodeID&,
	       const com::sun::star::uno::Reference<com::sun::star::lang::XEventListener>&)
	    + called for every node [ for some reason ]


* Listener Impls *
	+ provider.cxx:
	    + OProviderDisposingListener
	    + implements XEventListener_BASE
	+ propertiesfilterednotifier.cxx:
	    + XPropertiesChangeListener,
	      XEventListener
	+ broadcaster.cxx (?)

	+ One of the 'special' things about the cppuhelper container


    /*/.Name,.Property,.Value


  + 'GetGreatBlob' API call
    + how to manage the UNO type data for that ?
    + how to create a truly 'generic' type ?
	+ ultimately a sequence of any's (right) ?
	+ do we need a new type ?
	+ can we mangle some existing call ?


** Plague of listeners **:	

#0  configmgr::configapi::NotifierImpl::add (this=0xb5740e58, aNode=@0xbf853c24, xListener=@0xbf853d04) at notifierimpl.hxx:122
#1  configmgr::configapi::Notifier::add (this=0xbf853c6c, aNode=@0xbf853c78, xListener=@0xbf853d04) at configmgr/source/api2/confignotifier.cxx:126
#2  configmgr::configapi::genericAddListener<com::sun::star::lang::XEventListener> (rNode=@0xb573e1f4, xListener=@0xbf853d04) at configmgr/source/api2/apinotifierimpl.cxx:84
#3  configmgr::configapi::implAddListener (rNode=@0xb573e1f4, xListener=@0xbf853d04) at configmgr/source/api2/apinotifierimpl.cxx:178
#4  configmgr::BasicRootElement::addEventListener (this=0xb573e1a0, xListener=@0xbf853d04) at configmgr/source/api2/elementaccess.cxx:283


adds the ApiTreeImpl as a listener:

#5  configmgr::configapi::ApiTreeImpl::ComponentAdapter::setComponent (this=0xb5672f10, rxSlot=@0xb5672f28, xComp=@0xbf853d6c) at configmgr/source/api2/apitreeimplobj.cxx:150
#6  configmgr::configapi::ApiTreeImpl::ComponentAdapter::setParent (this=0xb5672f10, xParent=@0xbf853d6c) at configmgr/source/api2/apitreeimplobj.cxx:168
#7  configmgr::configapi::ApiTreeImpl::setParentTree (this=0xb56772bc, pParentTree=0xb573e1f8) at configmgr/source/api2/apitreeimplobj.cxx:730
#8  configmgr::configapi::ApiTreeImpl::init (this=0xb56772bc, pParentTree=0xb573e1f8) at configmgr/source/api2/apitreeimplobj.cxx:671
#9  ApiTreeImpl (this=0xb56772bc, pInstance=0xb5677264, rProvider=@0xb58da3ac, aTree=@0xbf853ee4, pParentTree=0xb573e1f8) at configmgr/source/api2/apitreeimplobj.cxx:417
#10 OSetElement (this=0xb56772b4, pUnoThis=0xb5677264, aTree=@0xbf853ee4, rProvider=@0xb58da3ac, pParentTree=0xb573e1f8) at apiaccessobj.hxx:106
#11 OSetElementGroupInfo (this=0xb5677250, aTree=@0xbf853ee4, rProvider=@0xb58da3ac, pParentTree=0xb573e1f8) at groupobjects.hxx:153
#12 configmgr::configapi::ReadOnlyObjectFactory::doCreateSetElement (this=0xb58da384, aElementTree=@0xbf853f48, pSetElementTemplate=0x0) at configmgr/source/api2/apifactoryimpl.cxx:151
#13 configmgr::configapi::Factory::makeElement (this=0xb58da384, aTree=@0xbf854068, aNode=@0xbf853fdc) at configmgr/source/api2/apifactory.cxx:193
#14 configmgr::configapi::Factory::makeUnoElement (this=0xb58da384, aTree=@0xbf854068, aNode=@0xbf853fdc) at configmgr/source/api2/apifactory.cxx:164
#15 configmgr::configapi::makeElement (rFactory=@0xb58da384, aTree=@0xbf854068, aNode=@0xbf854050) at configmgr/source/api2/apinodeaccess.cxx:134
#16 configmgr::configapi::implGetByName (rNode=@0xb573e1f4, sName=@0xb56dc010) at configmgr/source/api2/accessimpl.cxx:697
#17 configmgr::BasicSetAccess::getByName (this=0xb573e1c8, sName=@0xb56dc010) at configmgr/source/api2/setaccess.cxx:127


Instrumented access pattern wrt. m_aListeners:

File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/apitreeimplobj.cxx:480 void configmgr::configapi::ApiTreeImpl::checkAlive() const
File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/confignotifier.cxx:111 configmgr::configapi::NotifierImpl::NotifierImpl(const configmgr::configuration::TreeRef&)
File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/apitreeimplobj.cxx:465 void configmgr::configapi::ApiTreeImpl::setNodeInstance(const configmgr::configuration::NodeRef&, configmgr::configapi::UnoInterface*)
File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/notifierimpl.hxx:122 void configmgr::configapi::NotifierImpl::add(const configmgr::configuration::NodeID&, const com::sun::star::uno::Reference<com::sun::star::lang::XEventListener>&)
File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/apitreeimplobj.cxx:480 void configmgr::configapi::ApiTreeImpl::checkAlive() const
File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/apitreeimplobj.cxx:480 void configmgr::configapi::ApiTreeImpl::checkAlive() const
File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/apitreeimplobj.cxx:480 void configmgr::configapi::ApiTreeImpl::checkAlive() const
File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/apitreeimplobj.cxx:473 bool configmgr::configapi::ApiTreeImpl::isAlive() const
File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/notifierimpl.hxx:213 void configmgr::configapi::NotifierImpl::remove(const configmgr::configuration::NodeID&, const com::sun::star::uno::Reference<com::sun::star::lang::XEventListener>&)
File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/apitreeimplobj.cxx:584 bool configmgr::configapi::ApiTreeImpl::implDisposeTree(const configmgr::memory::Accessor&)
File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/apitreeimplobj.cxx:473 bool configmgr::configapi::ApiTreeImpl::isAlive() const
Error: File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/apitreeimplobj.cxx, Line 533
Backtrace: [0] ./configmgr2.uno.so: ???+0x1a065c
Backtrace: [1] ./configmgr2.uno.so: ???+0x19ca99
Backtrace: [2] ./configmgr2.uno.so: ???+0x1a91ef
Backtrace: [3] ./configmgr2.uno.so: ???+0x1a7352
Backtrace: [4] ./configmgr2.uno.so: ???+0x1ac473
Backtrace: [5] /opt/OOInstall/program/cfgdemo: ???+0x3ba9
Backtrace: [6] /opt/OOInstall/program/cfgdemo: ???+0x31bd
Backtrace: [7] /opt/OOInstall/program/cfgdemo: ???+0x35b8
Backtrace: [8] /opt/OOInstall/program/cfgdemo: main+0x1d8
Backtrace: [9] /lib/libc.so.6: __libc_start_main+0xdc
Backtrace: [10] /opt/OOInstall/program/cfgdemo: __gxx_personality_v0+0x59
File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/apitreeimplobj.cxx:480 void configmgr::configapi::ApiTreeImpl::checkAlive() const
File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/confignotifier.cxx:111 configmgr::configapi::NotifierImpl::NotifierImpl(const configmgr::configuration::TreeRef&)
File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/apitreeimplobj.cxx:465 void configmgr::configapi::ApiTreeImpl::setNodeInstance(const configmgr::configuration::NodeRef&, configmgr::configapi::UnoInterface*)
File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/notifierimpl.hxx:122 void configmgr::configapi::NotifierImpl::add(const configmgr::configuration::NodeID&, const com::sun::star::uno::Reference<com::sun::star::lang::XEventListener>&)
File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/apitreeimplobj.cxx:480 void configmgr::configapi::ApiTreeImpl::checkAlive() const
File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/apitreeimplobj.cxx:480 void configmgr::configapi::ApiTreeImpl::checkAlive() const
File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/apitreeimplobj.cxx:480 void configmgr::configapi::ApiTreeImpl::checkAlive() const
File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/apitreeimplobj.cxx:473 bool configmgr::configapi::ApiTreeImpl::isAlive() const
File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/notifierimpl.hxx:213 void configmgr::configapi::NotifierImpl::remove(const configmgr::configuration::NodeID&, const com::sun::star::uno::Reference<com::sun::star::lang::XEventListener>&)
File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/apitreeimplobj.cxx:584 bool configmgr::configapi::ApiTreeImpl::implDisposeTree(const configmgr::memory::Accessor&)
File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/apitreeimplobj.cxx:473 bool configmgr::configapi::ApiTreeImpl::isAlive() const
Error: File /opt/OpenOffice/OOO_2_0_2/configmgr/source/api2/apitreeimplobj.cxx, Line 533

** configmgr-lesslock.diff

    + analysing what's really going on...
    + SegmentHeap
	[ concurrent access possible ? ]

    + class Segment {
	    SegmentHeap m_heap;
	    ...
      };

    + class SegmentHeap : Noncopyable

ource/inc/datalock.hxx:49:             virtual void acquireReadAccess() = 0;
source/inc/segment.hxx:91:            void const * acquireReadAccess() const 
source/inc/segment.hxx:93:                this->lock().acquireReadAccess();
source/data/updateaccessor.cxx:78:                base = m_segment->acquireReadAccess();
source/data/simpleheap.cxx:179:            virtual void acquireReadAccess() { m_mutex.acquire(); }
source/data/accessor.cxx:58:            void const * base = m_segment ? m_segment->acquireReadAccess() : NULL;

source/inc/datalock.hxx:52:             virtual void acquireWriteAccess() = 0;          
source/inc/segment.hxx:80:            Heap& acquireWriteAccess()       
source/inc/segment.hxx:82:                this->lock().acquireWriteAccess(); 

on a segment:
source/data/updateaccessor.cxx:57:            m_heap = (m_segment) ? &m_segment->acquireWriteAccess() : 0;
source/data/simpleheap.cxx:182:            virtual void acquireWriteAccess() { m_mutex.acquire(); }     


+ datalock.hxx: DataLock (typedef'd to Lock)

   
it *seems* that 'isValidAddress'
    + burns 25% of time with debug build - is this
      the use of all this book-keeping state ?

    + SimpleCheckingHeapManager:
	+ only 2 instances (static):
	    + cacheHeap()
	    + localHeap()

    + Question:
	+ is the batch freeing of a 'Heap' relied on ?

* Strategy:
    + rip out the custom allocator crud ...
    + [ totally unnecessary ]
	+ Address - hunt/destroy (?)
    + hoist any 'Heap' stuff up as a 'shared lock' class (?)
	+ if it's used ...
        + Heap used for batch freeing too (!?) [urgh]

    + write a test tool ? [ for performance ]
	+ [ automated regression tests ? ]

TODO:
    + remove 'realloc' - never called in anger ?
    + 'anydata' should be an UNO type [ surely ... ]

    + calls to 'allocate'

source/data/sequence.cxx:131:    Sequence aResult = _anAllocator.allocate(nTotalSize);
source/data/sequence.cxx:209:    OSL_ENSURE(_pSeqData, "ERROR: Trying to allocate from a NULL sequence");
source/data/sequence.cxx:312:    _anAllocator.deallocate(_aSeq);
source/data/sequence.cxx:321:    _anAllocator.deallocate(_aSeq);

source/data/anydata.cxx:234:            Address aStorage = _anAllocator.allocate( sizeof nValue );
source/data/anydata.cxx:245:            Address aStorage = _anAllocator.allocate( sizeof dValue );
source/data/anydata.cxx:260:        OSL_ENSURE( false, "Trying to allocate void value" );
source/data/anydata.cxx:405:        _anAllocator.deallocate(_aData.longValue);
source/data/anydata.cxx:409:        _anAllocator.deallocate(_aData.doubleValue);

source/tree/builddata.cxx:646:    Address aBaseAddress = _anUpdater.allocator().allocate(nFragmentSize);
source/tree/builddata.cxx:1201:    allocator().deallocate( _aBaseAddress.addressValue() );
source/tree/node.cxx:242:    Address aData = _anAllocator.allocate(sizeof(SetNodeTemplateData));
source/tree/node.cxx:281:    _anAllocator.deallocate(_aTemplateData);

chains to heap:
source/data/updateaccessor.cxx:112:            return m_heap ? m_heap->allocate(_sz) : Allocator::Address();
source/data/updateaccessor.cxx:119:            if (m_heap) m_heap->deallocate(_addr);


Supposed leaks: 5 items:

#0  configmgr::memory::SimpleCheckingHeapManager::destroyHeap (this=0xa3e3d990, _aHeap=0x8132148)
    at /data/OpenOffice/ood680-m4/configmgr/source/data/simpleheap.cxx:354
#1  0xa3d6ae0d in ~Heap (this=0x8131cdc) at /data/OpenOffice/ood680-m4/configmgr/source/data/heap.cxx:78
#2  0xa3d6b175 in ~SegmentHeap (this=0x8131cd8) at /data/OpenOffice/ood680-m4/configmgr/source/data/segmentheap.cxx:58
#3  0xa3be96f3 in ~Segment (this=0x8131cd8) at ../inc/segment.hxx:56
#4  0xa3be98f3 in ~CacheLine (this=0x8131cd0) at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cacheline.hxx:75
#5  0xa3bd79b1 in salhelper::SimpleReferenceObject::release (this=0x8131cd0)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/salhelper/simplereferenceobject.hxx:98
#6  0xa3be4df0 in rtl::Reference<configmgr::CacheLine>::set (this=0x81302dc, pBody=0x8140d50)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/rtl/ref.hxx:125
#7  0xa3be4e10 in rtl::Reference<configmgr::CacheLine>::operator= (this=0x81302dc, handle=@0xbfe36150)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/rtl/ref.hxx:136
#8  0xa3be6853 in configmgr::CacheData::internalAddModule (this=0x810fb70, _aName=@0xbfe361e4, _aModule=@0xbfe36150)
    at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cachedata.cxx:166
#9  0xa3be3382 in configmgr::TemplateCacheData::implNewCacheLine (this=0x810fb70, _aModule=@0xbfe361e4)
    at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cachedata.cxx:443
#10 0xa3be33fc in configmgr::TemplateCacheData::createDataSegment (this=0x810fb70, _aModule=@0xbfe361e4)
    at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cachedata.cxx:396
#11 0xa3bedaca in configmgr::backend::CacheController::addTemplates (this=0x810fb38, _aComponentInstance=@0xbfe3628c)
    at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cachecontroller.cxx:565
#12 0xa3bf0c7b in configmgr::backend::CacheController::loadComponent (this=0x810fb38, _aRequest=@0xbfe36314)
    at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cachecontroller.cxx:462
#13 0xa3bf924a in configmgr::TreeManager::requestSubtree (this=0x810fe00, aSubtreePath=@0xbfe3645c, _aOptions=@0xbfe364cc)
    at /data/OpenOffice/ood680-m4/configmgr/source/treecache/treemanager.cxx:344
#14 0xa3d0b981 in configmgr::OProviderImpl::requestSubtree (this=0x80eca30, aSubtreePath=@0xbfe3645c, _aOptions=@0xbfe364cc)
    at /data/OpenOffice/ood680-m4/configmgr/source/api2/providerimpl.cxx:428
#15 0xa3d0c152 in configmgr::OProviderImpl::buildReadAccess (this=0x80eca30, _rAccessor=@0xbfe364e4, _aOptions=@0xbfe364cc, nMinLevels=-1)
    at /data/OpenOffice/ood680-m4/configmgr/source/api2/providerimpl.cxx:581
#16 0xa3d11b6d in configmgr::OConfigurationProviderImpl::createReadAccess (this=0x80eca30, aArgs=@0xbfe36574)
    at /data/OpenOffice/ood680-m4/configmgr/source/api2/confproviderimpl2.cxx:108
#17 0xa3d0edee in configmgr::OConfigurationProvider::createInstanceWithArguments (this=0x80ec2b0, aServiceSpecifier=@0xbfe36584, aArguments=@0xbfe36574)
    at /data/OpenOffice/ood680-m4/configmgr/source/api2/confprovider2.cxx:364

Leaked: 5 items

#0  configmgr::memory::SimpleCheckingHeapManager::destroyHeap (this=0xa3e3d990, _aHeap=0x8558618)
    at /data/OpenOffice/ood680-m4/configmgr/source/data/simpleheap.cxx:354
#1  0xa3d6ae0d in ~Heap (this=0x856751c) at /data/OpenOffice/ood680-m4/configmgr/source/data/heap.cxx:78
#2  0xa3d6b175 in ~SegmentHeap (this=0x8567518) at /data/OpenOffice/ood680-m4/configmgr/source/data/segmentheap.cxx:58
#3  0xa3be96f3 in ~Segment (this=0x8567518) at ../inc/segment.hxx:56
#4  0xa3be98f3 in ~CacheLine (this=0x8567510) at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cacheline.hxx:75
#5  0xa3bd79b1 in salhelper::SimpleReferenceObject::release (this=0x8567510)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/salhelper/simplereferenceobject.hxx:98
#6  0xa3be4df0 in rtl::Reference<configmgr::CacheLine>::set (this=0x81e351c, pBody=0x85ee688)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/rtl/ref.hxx:125
#7  0xa3be4e10 in rtl::Reference<configmgr::CacheLine>::operator= (this=0x81e351c, handle=@0xbfe351e0)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/rtl/ref.hxx:136
#8  0xa3be6853 in configmgr::CacheData::internalAddModule (this=0x810fb70, _aName=@0xbfe35274, _aModule=@0xbfe351e0)
    at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cachedata.cxx:166
#9  0xa3be3382 in configmgr::TemplateCacheData::implNewCacheLine (this=0x810fb70, _aModule=@0xbfe35274)
    at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cachedata.cxx:443
#10 0xa3be33fc in configmgr::TemplateCacheData::createDataSegment (this=0x810fb70, _aModule=@0xbfe35274)
    at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cachedata.cxx:396
#11 0xa3bedaca in configmgr::backend::CacheController::addTemplates (this=0x810fb38, _aComponentInstance=@0xbfe3531c)
    at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cachecontroller.cxx:565
#12 0xa3bf0c7b in configmgr::backend::CacheController::loadComponent (this=0x810fb38, _aRequest=@0xbfe353a4)
    at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cachecontroller.cxx:462
#13 0xa3bf924a in configmgr::TreeManager::requestSubtree (this=0x810fe00, aSubtreePath=@0xbfe354ec, _aOptions=@0xbfe3555c)
    at /data/OpenOffice/ood680-m4/configmgr/source/treecache/treemanager.cxx:344
#14 0xa3d0b981 in configmgr::OProviderImpl::requestSubtree (this=0x80eca30, aSubtreePath=@0xbfe354ec, _aOptions=@0xbfe3555c)
    at /data/OpenOffice/ood680-m4/configmgr/source/api2/providerimpl.cxx:428
#15 0xa3d0bd8a in configmgr::OProviderImpl::buildUpdateAccess (this=0x80eca30, _rAccessor=@0xbfe35574, _aOptions=@0xbfe3555c, nMinLevels=-1)
    at /data/OpenOffice/ood680-m4/configmgr/source/api2/providerimpl.cxx:623
#16 0xa3d11963 in configmgr::OConfigurationProviderImpl::createUpdateAccess (this=0x80eca30, aArgs=@0xbfe356b8)
    at /data/OpenOffice/ood680-m4/configmgr/source/api2/confproviderimpl2.cxx:140
#17 0xa3d0edee in configmgr::OConfigurationProvider::createInstanceWithArguments (this=0x80ec2b0, aServiceSpecifier=@0xbfe356bc, aArguments=@0xbfe356b8)
    at /data/OpenOffice/ood680-m4/configmgr/source/api2/confprovider2.cxx:364
#18 0xa229f6a4 in filter::config::FilterCache::impl_createConfigAccess (this=0x8541478, sRoot=@0xbfe35718, bReadOnly=0 '\0', bLocalesMode=1 '\001')
    at /opt/OpenOffice/ood680-m4/filter/source/config/cache/filtercache.cxx:1061
#19 0xa22a56e5 in filter::config::FilterCache::impl_openConfig (this=0x8541478, eProvider=filter::config::FilterCache::E_PROVIDER_OTHERS)
    at /opt/OpenOffice/ood680-m4/filter/source/config/cache/filtercache.cxx:958
#20 0xa22a6cc1 in filter::config::FilterCache::impl_load (this=0x8541478, eRequiredState=filter::config::FilterCache::E_CONTAINS_FRAMELOADERS)
    at /opt/OpenOffice/ood680-m4/filter/source/config/cache/filtercache.cxx:1548
#21 0xa22a8bd5 in filter::config::FilterCache::load (this=0x8541478, eRequired=filter::config::FilterCache::E_CONTAINS_FRAMELOADERS, bByThread=0 '\0')
    at /opt/OpenOffice/ood680-m4/filter/source/config/cache/filtercache.cxx:332
#22 0xa2291b5d in filter::config::BaseContainer::impl_loadOnDemand (this=0x85d7ae0)
    at /opt/OpenOffice/ood680-m4/filter/source/config/cache/basecontainer.cxx:158
#23 0xa2292522 in filter::config::BaseContainer::createSubSetEnumerationByProperties (this=0x85d7ae0, lProperties=@0xbfe359a8)
    at /opt/OpenOffice/ood680-m4/filter/source/config/cache/basecontainer.cxx:527

leaked: 30 items.

#0  configmgr::memory::SimpleCheckingHeapManager::destroyHeap (this=0xa3e3d990, _aHeap=0x828a2a8)
    at /data/OpenOffice/ood680-m4/configmgr/source/data/simpleheap.cxx:354
#1  0xa3d6ae0d in ~Heap (this=0x8280f94) at /data/OpenOffice/ood680-m4/configmgr/source/data/heap.cxx:78
#2  0xa3d6b175 in ~SegmentHeap (this=0x8280f90) at /data/OpenOffice/ood680-m4/configmgr/source/data/segmentheap.cxx:58
#3  0xa3be96f3 in ~Segment (this=0x8280f90) at ../inc/segment.hxx:56
#4  0xa3be9737 in ~CacheLine (this=0x8280f88) at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cacheline.hxx:75
#5  0xa3be97f2 in ~ExtendedCacheLine (this=0x8280f88) at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cacheline.hxx:151
#6  0xa3bd79b1 in salhelper::SimpleReferenceObject::release (this=0x8280f88)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/salhelper/simplereferenceobject.hxx:98
#7  0xa3bd79d4 in ~Reference (this=0x81cc75c) at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/rtl/ref.hxx:111
#8  0xa3be0f93 in ~pair (this=0x81cc758) at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_pair.h:37
#9  0xa3be0fe3 in _STL::_Destroy<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > > (__pointer=0x81cc758)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_construct.h:67
#10 0xa3be10e8 in _STL::_Rb_tree<configmgr::configuration::Name, _STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> >, _STL::_Select1st<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > >, _STL::less<configmgr::configuration::Name>, _STL::allocator<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > > >::_M_erase (this=0x80d7d40, __x=0x81cc748)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_tree.c:637
#11 0xa3be10ca in _STL::_Rb_tree<configmgr::configuration::Name, _STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> >, _STL::_Select1st<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > >, _STL::less<configmgr::configuration::Name>, _STL::allocator<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > > >::_M_erase (this=0x80d7d40, __x=0x81cca30)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_tree.c:635
#12 0xa3be10ca in _STL::_Rb_tree<configmgr::configuration::Name, _STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> >, _STL::_Select1st<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > >, _STL::less<configmgr::configuration::Name>, _STL::allocator<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > > >::_M_erase (this=0x80d7d40, __x=0x81c0858)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_tree.c:635
#13 0xa3be10ca in _STL::_Rb_tree<configmgr::configuration::Name, _STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> >, _STL::_Select1st<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > >, _STL::less<configmgr::configuration::Name>, _STL::allocator<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > > >::_M_erase (this=0x80d7d40, __x=0x8134a88)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_tree.c:635
#14 0xa3be10ca in _STL::_Rb_tree<configmgr::configuration::Name, _STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> >, _STL::_Select1st<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > >, _STL::less<configmgr::configuration::Name>, _STL::allocator<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > > >::_M_erase (this=0x80d7d40, __x=0x81f04c0)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_tree.c:635
#15 0xa3be114e in _STL::_Rb_tree<configmgr::configuration::Name, _STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> >, _STL::_Select1st<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > >, _STL::less<configmgr::configuration::Name>, _STL::allocator<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > > >::clear (this=0x80d7d40)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_tree.h:447
#16 0xa3be5682 in ~_Rb_tree (this=0x80d7d40) at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_tree.h:341
#17 0xa3be56d3 in ~map (this=0x80d7d40) at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_map.h:44
#18 0xa3be324b in ~CacheData (this=0x80d7d3c) at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cachedata.cxx:136
#19 0xa3be21db in ~ExtendedCacheData (this=0x80d7d3c) at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cachedata.hxx:174
#20 0xa3bde965 in ~CacheLoadingAccess (this=0x80d7d30) at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cacheaccess.cxx:220
#21 0xa3bd79b1 in salhelper::SimpleReferenceObject::release (this=0x80d7d30)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/salhelper/simplereferenceobject.hxx:98
#22 0xa3bd7a9c in ~Reference (this=0x811044c) at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/rtl/ref.hxx:111
#23 0xa3bf37f3 in ~pair (this=0x8110438) at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_pair.h:37
#24 0xa3bf3843 in _STL::_Destroy<_STL::pair<configmgr::RequestOptions const, rtl::Reference<configmgr::CacheLoadingAccess> > > (__pointer=0x8110438)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_construct.h:67
#25 0xa3bf3894 in _STL::_Rb_tree<configmgr::RequestOptions, _STL::pair<configmgr::RequestOptions const, rtl::Reference<configmgr::CacheLoadingAccess> >, _STL::_Select1st<_STL::pair<configmgr::RequestOptions const, rtl::Reference<configmgr::CacheLoadingAccess> > >, configmgr::lessRequestOptions, _STL::allocator<_STL::pair<configmgr::RequestOptions const, rtl::Reference<configmgr::CacheLoadingAccess> > > >::_M_erase (this=0xbfe36414, __x=0x8110428)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_tree.c:637
#26 0xa3bf3876 in _STL::_Rb_tree<configmgr::RequestOptions, _STL::pair<configmgr::RequestOptions const, rtl::Reference<configmgr::CacheLoadingAccess> >, _STL::_Select1st<_STL::pair<configmgr::RequestOptions const, rtl::Reference<configmgr::CacheLoadingAccess> > >, configmgr::lessRequestOptions, _STL::allocator<_STL::pair<configmgr::RequestOptions const, rtl::Reference<configmgr::CacheLoadingAccess> > > >::_M_erase (this=0xbfe36414, __x=0x82900d8)

leaked 100's of items:

#0  configmgr::memory::SimpleCheckingHeapManager::destroyHeap (this=0xa3e3d990, _aHeap=0x81c6bd0)
    at /data/OpenOffice/ood680-m4/configmgr/source/data/simpleheap.cxx:354
#1  0xa3d6ae0d in ~Heap (this=0x81456b4) at /data/OpenOffice/ood680-m4/configmgr/source/data/heap.cxx:78
#2  0xa3d6b175 in ~SegmentHeap (this=0x81456b0) at /data/OpenOffice/ood680-m4/configmgr/source/data/segmentheap.cxx:58
#3  0xa3be96f3 in ~Segment (this=0x81456b0) at ../inc/segment.hxx:56

	+ this is our internal / custom allocated segment [!]

#4  0xa3be9737 in ~CacheLine (this=0x81456a8) at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cacheline.hxx:75
#5  0xa3be97f2 in ~ExtendedCacheLine (this=0x81456a8) at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cacheline.hxx:151
#6  0xa3bd79b1 in salhelper::SimpleReferenceObject::release (this=0x81456a8)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/salhelper/simplereferenceobject.hxx:98
#7  0xa3bd79d4 in ~Reference (this=0x81c086c) at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/rtl/ref.hxx:111
#8  0xa3be0f93 in ~pair (this=0x81c0868) at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_pair.h:37
#9  0xa3be0fe3 in _STL::_Destroy<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > > (__pointer=0x81c0868)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_construct.h:67
#10 0xa3be10e8 in _STL::_Rb_tree<configmgr::configuration::Name, _STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> >, _STL::_Select1st<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > >, _STL::less<configmgr::configuration::Name>, _STL::allocator<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > > >::_M_erase (this=0x80d7d40, __x=0x81c0858)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_tree.c:637
#11 0xa3be10ca in _STL::_Rb_tree<configmgr::configuration::Name, _STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> >, _STL::_Select1st<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > >, _STL::less<configmgr::configuration::Name>, _STL::allocator<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > > >::_M_erase (this=0x80d7d40, __x=0x8134a88)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_tree.c:635
#12 0xa3be10ca in _STL::_Rb_tree<configmgr::configuration::Name, _STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> >, _STL::_Select1st<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > >, _STL::less<configmgr::configuration::Name>, _STL::allocator<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > > >::_M_erase (this=0x80d7d40, __x=0x81f04c0)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_tree.c:635
#13 0xa3be114e in _STL::_Rb_tree<configmgr::configuration::Name, _STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> >, _STL::_Select1st<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > >, _STL::less<configmgr::configuration::Name>, _STL::allocator<_STL::pair<configmgr::configuration::Name const, rtl::Reference<configmgr::CacheLine> > > >::clear (this=0x80d7d40)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_tree.h:447
#14 0xa3be5682 in ~_Rb_tree (this=0x80d7d40) at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_tree.h:341
#15 0xa3be56d3 in ~map (this=0x80d7d40) at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_map.h:44
#16 0xa3be324b in ~CacheData (this=0x80d7d3c) at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cachedata.cxx:136
#17 0xa3be21db in ~ExtendedCacheData (this=0x80d7d3c) at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cachedata.hxx:174
#18 0xa3bde965 in ~CacheLoadingAccess (this=0x80d7d30) at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cacheaccess.cxx:220
#19 0xa3bd79b1 in salhelper::SimpleReferenceObject::release (this=0x80d7d30)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/salhelper/simplereferenceobject.hxx:98
#20 0xa3bd7a9c in ~Reference (this=0x811044c) at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/rtl/ref.hxx:111
#21 0xa3bf37f3 in ~pair (this=0x8110438) at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_pair.h:37
#22 0xa3bf3843 in _STL::_Destroy<_STL::pair<configmgr::RequestOptions const, rtl::Reference<configmgr::CacheLoadingAccess> > > (__pointer=0x8110438)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_construct.h:67
#23 0xa3bf3894 in _STL::_Rb_tree<configmgr::RequestOptions, _STL::pair<configmgr::RequestOptions const, rtl::Reference<configmgr::CacheLoadingAccess> >, _STL::_Select1st<_STL::pair<configmgr::RequestOptions const, rtl::Reference<configmgr::CacheLoadingAccess> > >, configmgr::lessRequestOptions, _STL::allocator<_STL::pair<configmgr::RequestOptions const, rtl::Reference<configmgr::CacheLoadingAccess> > > >::_M_erase (this=0xbfe36414, __x=0x8110428)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_tree.c:637
#24 0xa3bf3876 in _STL::_Rb_tree<configmgr::RequestOptions, _STL::pair<configmgr::RequestOptions const, rtl::Reference<configmgr::CacheLoadingAccess> >, _STL::_Select1st<_STL::pair<configmgr::RequestOptions const, rtl::Reference<configmgr::CacheLoadingAccess> > >, configmgr::lessRequestOptions, _STL::allocator<_STL::pair<configmgr::RequestOptions const, rtl::Reference<configmgr::CacheLoadingAccess> > > >::_M_erase (this=0xbfe36414, __x=0x82900d8)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_tree.c:635
#25 0xa3bf38fa in _STL::_Rb_tree<configmgr::RequestOptions, _STL::pair<configmgr::RequestOptions const, rtl::Reference<configmgr::CacheLoadingAccess> >, _STL::_Select1st<_STL::pair<configmgr::RequestOptions const, rtl::Reference<configmgr::CacheLoadingAccess> > >, configmgr::lessRequestOptions, _STL::allocator<_STL::pair<configmgr::RequestOptions const, rtl::Reference<configmgr::CacheLoadingAccess> > > >::clear (this=0xbfe36414)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_tree.h:447
#26 0xa3bf39c7 in _STL::map<configmgr::RequestOptions, rtl::Reference<configmgr::CacheLoadingAccess>, configmgr::lessRequestOptions, _STL::allocator<_STL::pair<configmgr::RequestOptions const, rtl::Reference<configmgr::CacheLoadingAccess> > > >::clear (this=0xbfe36414)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/stl/stl/_map.h:191
#27 0xa3beeadb in configmgr::backend::CacheController::disposeAll (this=0x810fb38, _bFlushRemainingUpdates=true)
    at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cachecontroller.cxx:182
#28 0xa3beeb83 in configmgr::backend::CacheController::dispose (this=0x810fb38)
    at /data/OpenOffice/ood680-m4/configmgr/source/treecache/cachecontroller.cxx:197
#29 0xa3bf7536 in configmgr::TreeManager::disposeBackendCache (this=0x810fe00) at /data/OpenOffice/ood680-m4/configmgr/source/treecache/treemanager.cxx:287
#30 0xa3bfae8c in configmgr::TreeManager::dispose (this=0x810fe00) at /data/OpenOffice/ood680-m4/configmgr/source/treecache/treemanager.cxx:138
#31 0xa3d0c81e in configmgr::OProviderImpl::dispose (this=0x80eca30) at /data/OpenOffice/ood680-m4/configmgr/source/api2/providerimpl.cxx:379
#32 0xa3d0ef51 in configmgr::OConfigurationProvider::disposing (this=0x80ec2b0) at /data/OpenOffice/ood680-m4/configmgr/source/api2/confprovider2.cxx:339
#33 0xb765c2a5 in cppu::WeakComponentImplHelperBase::dispose () from ./libuno_cppuhelpergcc3.so.3
#34 0xa3bc5407 in cppu::WeakComponentImplHelper1<com::sun::star::lang::XServiceInfo>::dispose (this=0x80ec2b0)
    at /opt/OpenOffice/ood680-m4/solver/680/unxlngi6.pro/inc/cppuhelper/compbase1.hxx:91
#35 0xa3d0730a in configmgr::OProvider::disposing (this=0x80ec2b0) at /data/OpenOffice/ood680-m4/configmgr/source/api2/provider.cxx:218
#36 0xa3d0898a in configmgr::OProviderDisposingListener::disposing (this=0x80e75a8, rEvt=@0xbfe36684)
    at /data/OpenOffice/ood680-m4/configmgr/source/api2/provider.cxx:95
#37 0xb7663f1a in cppu::OInterfaceContainerHelper::disposeAndClear () from ./libuno_cppuhelpergcc3.so.3
#38 0xb76640f6 in cppu::OMultiTypeInterfaceContainerHelper::disposeAndClear () from ./libuno_cppuhelpergcc3.so.3
#39 0xb765c29a in cppu::WeakComponentImplHelperBase::dispose () from ./libuno_cppuhelpergcc3.so.3
#40 0xb766d24f in cppu::WeakComponentImplHelper2<com::sun::star::uno::XComponentContext, com::sun::star::container::XNameContainer>::dispose ()
   from ./libuno_cppuhelpergcc3.so.3
#41 0x08074d9e in desktop::Desktop::DestroyApplicationServiceManager ()
#42 0x0806716a in desktop::Desktop::DeInit ()
#43 0xb7d4ed90 in DeInitVCL () from ./libvcl680li.so
#44 0xb7d4f28a in ImplSVMain () from ./libvcl680li.so
#45 0xb7d4f2f3 in SVMain () from ./libvcl680li.so
#46 0x08064641 in sal_main ()
#47 0xb6e7087c in __libc_start_main (main=0x8064664 <main>, argc=2, ubp_av=0xbfe36834, init=0x807fb50 <__libc_csu_init>, fini=0x807fb40 <__libc_csu_fini>, 
    rtld_fini=0xb7f90550 <_dl_fini>, stack_end=0xbfe3682c) at libc-start.c:231
#48 0x08064571 in _start ()


Binning the 'source/treecache' directory gives:

../unxlngi6.pro/slo/providerimpl.o: In function `configmgr::OProviderImpl::initSession(configmgr::ContextReader const&)':
/data/OpenOffice/ood680-m4/configmgr/source/api2/providerimpl.cxx:233: undefined reference to `configmgr::CacheFactory::instance()'
/data/OpenOffice/ood680-m4/configmgr/source/api2/providerimpl.cxx:233: undefined reference to `configmgr::CacheFactory::createCacheManager(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&)'
../unxlngi6.pro/slo/providerimpl.o: In function `configmgr::OProviderImpl::dispose()':
/data/OpenOffice/ood680-m4/configmgr/source/api2/providerimpl.cxx:379: undefined reference to `configmgr::TreeManager::dispose()'
collect2: ld returned 1 exit status

	  + All goes through the treemanager.hxx interface [simple]

** TODO:
    + remove 'Segment'


+ Binned 'SegmentID' (string) in error ...
    + axed 'SegmentAddress' in error [?!]

+ Next:
    + 'Allocator' ?
    + 'Accessor' ?
    + bin 'SegmentId' (?)
    + bin 'SegmentAddress' (?)

    + Accessor:
	+ calls acquire/release ReadAccess 
	+ source/data/ updateAccessor ...
	+ Read & Write access are the same thing [!?] :-)
	    + just holding the lock ...
    + UpdateAccessor
	+ 'downgrade' - used ?
    + why lock ?
	+ no 2 threads concurrently writing the same
	  memory being 'accessed' - but ...
	    + if we have a ptr to it anyway, surely
	      we must protect lifecycle ?
	    + who has a pointer to it ?

    + re-test with just debug=true on ...

	    + retain it's locking semantic.

    + remove bogus Accessors [ not all ]
	+ doGetDataSegmentForUpdate

    killed Allocator, Heap, HeapManager, DataLock (->Segment)
    Accessor -> just a locking wrapper


* No performance hit *

after:

001763 1 } PERFORMANCE - DesktopOpenClients_Impl()
001629 1 } PERFORMANCE - DesktopOpenClients_Impl()
001700 1 } PERFORMANCE - DesktopOpenClients_Impl()
001747 1 } PERFORMANCE - DesktopOpenClients_Impl()

before:

001794 1 } PERFORMANCE - DesktopOpenClients_Impl()
001837 1 } PERFORMANCE - DesktopOpenClients_Impl()
001708 1 } PERFORMANCE - DesktopOpenClients_Impl()
001760 1 } PERFORMANCE - DesktopOpenClients_Impl()


Configmgr comments:

> [*] Any tree structure growing from one root node conceptually has an 
> own segment. Possible trees are: the entire data tree for one 
> 'component' in the cache, all templates in the cache as one tree (with 
> an artificial root node) and the data tree for a 'set' element (template 
> instance) that is not currently contained in a set. The last kind is 
> local to a 'view' and never shared.
> 
> > 	All allocation is now done from the global heap.
> > 
> 
> I'd suggest to use rtl_(de)allocate directly instead of 
> new/new[]/delete/delete[] for the low-level allocations.
> 

** reinterpret_cast<> is reqired:

> (I admit to 
> sometimes using constructor-style casts for numerical conversions that 
> could be done with static_cast, but for pointers and references only the 
> verbose casts should be used.

** More easy / low-hanging fruit.

>- The separation between TreeManager and CacheController and the two 
> slightly different Cache -Data, -Line, -Access hierarchies. The 
> separation between a process that handles loading/storing and a client 
> process was supposed to be between them.
>
> - Additional abstractions (Tree + Accessor -> view::Tree) and other 
> complexity in the view layer ('treemgr' directory). That was always on 
> top of my list of things to fix - but also the most complex one. (There 
> are a few bugs associated to that as well.)

> Where you say
>   #warning This looks -totally- whacked out !
> you are right.

** bin that code

>>       My 1 remaining concern is that (perhaps) the 'Free a whole Segment'
>> thing is actually relied upon, but I suspect if so, it's symptomatic of
>> a leak somewhere ;-) [ at least now we can detect leaks more easily,
>> since we don't hold pointers to all allocated blocks ;-].
>> 
>
>Of course if there was a concious reliance on that feature it wasn't
>really a leak. It may well be the case that discarding an expired
>cache segment or a 'detached set element' segment - after inserting
>it, when disposing it or when the entire view goes away (the latter
>two should be similar) - does not bother to iterate the data
>structures within to release individual pieces.



** freeTree problem:

==4473== Invalid read of size 4
==4473==    at 0x29631DC9: configmgr::sharable::NodeInfo::getName() const (node.cxx:85)
==4473==    by 0x29631E0C: configmgr::sharable::Node::getName() const (node.cxx:422)
==4473==    by 0x294A776D: configmgr::data::NodeAccess::getName() const (nodeaccess.hxx:88)
==4473==    by 0x294A5D28: configmgr::CacheLine::internalGetNode(configmgr::memory::Accessor const&, configmgr::configuration::AbsolutePath const&) const (cacheline.cxx:208)
==4473==    by 0x294A5F4F: configmgr::CacheLine::getNode(configmgr::memory::Accessor const&, configmgr::configuration::AbsolutePath const&) const (cacheline.cxx:222)
==4473==    by 0x294A0CF3: configmgr::CacheData::internalGetNode(configmgr::memory::Accessor const&, configmgr::configuration::AbsolutePath const&) const (cachedata.cxx:289)
==4473==    by 0x294A11DF: configmgr::CacheData::acquireNode(configmgr::memory::Accessor const&, configmgr::configuration::AbsolutePath const&) (cachedata.cxx:325)
==4473==    by 0x2949C4AA: configmgr::CacheClientAccess::acquireNode(configmgr::memory::Accessor const&, configmgr::configuration::AbsolutePath const&) (cacheaccess.cxx:138)
==4473==    by 0x294B7396: configmgr::TreeManager::requestSubtree(configmgr::configuration::AbsolutePath const&, configmgr::RequestOptions const&) (treemanager.cxx:374)
==4473==    by 0x295C9658: configmgr::OProviderImpl::requestSubtree(configmgr::configuration::AbsolutePath const&, configmgr::RequestOptions const&) (providerimpl.cxx:431)
==4473==    by 0x295C9A61: configmgr::OProviderImpl::buildUpdateAccess(rtl::OUString const&, configmgr::RequestOptions const&, long) (providerimpl.cxx:626)
==4473==    by 0x295CF63A: configmgr::OConfigurationProviderImpl::createUpdateAccess(com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) (confproviderimpl2.cxx:143)
==4473==    by 0x295CCAC5: configmgr::OConfigurationProvider::createInstanceWithArguments(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) (confprovider2.cxx:367)
==4473==    by 0x807D727: desktop::LanguageSelection::getConfigAccess(char const*, unsigned char) (in /opt/HHInstall/program/soffice.bin)
==4473==    by 0x807E438: desktop::LanguageSelection::prepareLanguage() (in /opt/HHInstall/program/soffice.bin)
==4473==    by 0x806B0E8: desktop::Desktop::Init() (in /opt/HHInstall/program/soffice.bin)
==4473==    by 0x40B1D46: InitVCL(com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> const&) (in /data/OpenOffice/ooe680-m2/vcl/unxlngi6.pro/lib/libvcl680li.so)
==4473==    by 0x40B1EA3: ImplSVMain() (in /data/OpenOffice/ooe680-m2/vcl/unxlngi6.pro/lib/libvcl680li.so)
==4473==    by 0x40B1FB0: SVMain() (in /data/OpenOffice/ooe680-m2/vcl/unxlngi6.pro/lib/libvcl680li.so)
==4473==    by 0x80644F0: sal_main (in /opt/HHInstall/program/soffice.bin)
==4473==    by 0x506987B: (below main) (libc-start.c:231)

==4473==  Address 0x298F3320 is 16 bytes inside a block of size 96 free'd
==4473==    at 0x4020FB0: free (vg_replace_malloc.c:233)
==4473==    by 0x49D3926: rtl_freeMemory (in /opt/HHInstall/program/libuno_sal.so.3)
==4473==    by 0x29623EFA: configmgr::memory::SimpleHeapManagerBase::deallocateMemory(unsigned long) (simpleheap.cxx:231)
==4473==    by 0x296240F5: configmgr::memory::SimpleCheckingHeapManager::deallocate(configmgr::memory::Opaque_*, unsigned long) (simpleheap.cxx:471)
==4473==    by 0x2962C9BB: configmgr::memory::Heap::deallocate(unsigned long) (heap.hxx:82)
==4473==    by 0x2962C9DC: configmgr::memory::SegmentHeap::deallocate(unsigned long) (segmentheap.hxx:96)
==4473==    by 0x2962C6D4: configmgr::memory::Allocator::deallocate(unsigned long) const (updateaccessor.cxx:122)
==4473==    by 0x2962D114: configmgr::data::DataTreeCleanup::destroyTree(configmgr::data::TreeAddress) (builddata.cxx:1207)
==4473==    by 0x2962D30E: configmgr::data::destroyTree(configmgr::memory::UpdateAccessor&, configmgr::data::TreeAddress) (builddata.cxx:480)
==4473==    by 0x29635177: configmgr::data::TreeAccessor::freeTree(configmgr::memory::UpdateAccessor&, configmgr::data::TreeAddress) (treeaccessor.cxx:80)
==4473==    by 0x294A631B: configmgr::CacheLine::~CacheLine() (cacheline.cxx:108)
==4473==    by 0x294948D0: salhelper::SimpleReferenceObject::release() (simplereferenceobject.hxx:98)
==4473==    by 0x294948F3: rtl::Reference<configmgr::CacheLine>::~Reference() (ref.hxx:111)
==4473==    by 0x294A09C5: configmgr::CacheData::releaseModule(configmgr::configuration::Name const&, bool) (cachedata.cxx:410)
==4473==    by 0x2949C1BA: configmgr::CacheClientAccess::releaseNode(configmgr::configuration::AbsolutePath const&) (cacheaccess.cxx:157)
==4473==    by 0x294B5758: configmgr::TreeManager::releaseSubtree(configmgr::configuration::AbsolutePath const&, configmgr::RequestOptions const&) (treemanager.cxx:580)
==4473==    by 0x295CA3E0: configmgr::OProviderImpl::releaseSubtree(configmgr::configuration::AbsolutePath const&, configmgr::RequestOptions const&) (providerimpl.cxx:467)
==4473==    by 0x295E920F: configmgr::configapi::ApiRootTreeImpl::releaseData() (apitreeimplobj.cxx:833)
==4473==    by 0x295EAF73: configmgr::configapi::ApiRootTreeImpl::disposeTree() (apitreeimplobj.cxx:568)
==4473==    by 0x295E82EB: configmgr::configapi::RootElement::disposeTree() (apitreeaccess.cxx:129)
==4473==    by 0x295F9008: configmgr::configapi::implDisposeObject(configmgr::configapi::NodeAccess&, configmgr::configapi::RootElement&) (elementimpl.cxx:393)
==4473==    by 0x295F722B: configmgr::BasicRootElement::release() (elementaccess.cxx:92)
==4473==    by 0x295FC2EA: configmgr::ORootElementGroupInfo::release() (groupobjects.cxx:302)
==4473==    by 0x807E3DA: desktop::LanguageSelection::prepareLanguage() (in /opt/HHInstall/program/soffice.bin)
==4473==    by 0x806B0E8: desktop::Desktop::Init() (in /opt/HHInstall/program/soffice.bin)
==4473==    by 0x40B1D46: InitVCL(com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> const&) (in /data/OpenOffice/ooe680-m2/vcl/unxlngi6.pro/lib/libvcl680li.so)
==4473==    by 0x40B1EA3: ImplSVMain() (in /data/OpenOffice/ooe680-m2/vcl/unxlngi6.pro/lib/libvcl680li.so)
==4473==    by 0x40B1FB0: SVMain() (in /data/OpenOffice/ooe680-m2/vcl/unxlngi6.pro/lib/libvcl680li.so)
==4473==    by 0x80644F0: sal_main (in /opt/HHInstall/program/soffice.bin)
==4473==    by 0x506987B: (below main) (libc-start.c:231)


** Substantial chunks of memory wasteage:

	typedef std::set<INode*, ltNode> ChildList;

318k - allocated in these set nodes ...
     + [ on writer startup ]
	
	class ChildListSet {
		ChildList m_aChildList;
		
		ChildListSet(ChildListSet const&);
        ChildListSet& operator=(ChildListSet const& aSet);
	public:
		ChildList& GetSet() {return m_aChildList;}
		ChildList const& GetSet() const {return m_aChildList;}

		ChildListSet() {}
        ChildListSet(ChildListSet const&, treeop::DeepChildCopy);
		~ChildListSet();
	};	
	
michael@t60p:/opt/OpenOffice/OOE680_m6/configmgr> grep -R 'GetSet' source
source/tree/cmtree.cxx:         for(ChildList::iterator it = aSet.GetSet().begin();
source/tree/cmtree.cxx:                 it != aSet.GetSet().end();
source/tree/cmtree.cxx:         for (ChildList::iterator it2 = m_aChildren.GetSet().begin();
source/tree/cmtree.cxx:                 it2 != m_aChildren.GetSet().end();
source/tree/cmtree.cxx:         ChildList::iterator it = m_aChildren.GetSet().find(&searchObj);
source/tree/cmtree.cxx:         if (it == m_aChildren.GetSet().end())
source/tree/cmtree.cxx:                 m_aChildren.GetSet().insert(aNode.get());
source/tree/cmtree.cxx:         ChildList::const_iterator it = m_aChildren.GetSet().find(&searchObj);
source/tree/cmtree.cxx:         if (m_aChildren.GetSet().end() != it)
source/tree/cmtree.cxx:                 m_aChildren.GetSet().erase(it);
source/tree/cmtree.cxx:         for(ChildList::const_iterator it = m_aChildren.GetSet().begin();
source/tree/cmtree.cxx:                 it != m_aChildren.GetSet().end();
source/tree/cmtree.cxx:         ChildList::iterator it = m_aChildren.GetSet().begin();
source/tree/cmtree.cxx:         while( it != m_aChildren.GetSet().end() )
source/tree/subtree.hxx:                ChildList& GetSet() {return m_aChildList;}
source/tree/subtree.hxx:                ChildList const& GetSet() const {return m_aChildList;}

        I'm also looking at the Subtree set usage:

        http://go-oo.org/~michael/sortedsizes.ods

        My concern here is the 16bytes per RBTree node (used in the set), at
least allocation here shows up on the profile.

        It seems that 90% of these sorted sets are 8 items or less, and thus (I
suspect) rather fast to search, well, at least indistinguishable from
the order of the Set. The RBTree overhead for these <= 8 sets is ~250k
(malloc), overall 500k. I'm sure we can do better.

    + a sorted vector instead !?

number	      length:
   1544       1 
    303       2 
   2162       3 
    275       4 
     50       5 
    151       6 
    706       7 
     39       8 
     79       9 
    124      10 
     87      11 
     27      12 
     15      13 
     75      14 
      3      15 
     77      16 
     11      17 
     10      18 
     15      19 
     10      20 
      8      21 
      3      22 
      3      23 
      3      24 
      6      25 
      5      26 
      1      27 
      3      30 
      7      31 
      1      32 
      2      37 
      4      38 
      1      39 
      1      41 
      3      42 
      1      44 
      1      46 
      1      49 
      1      54 
      1     107 
      1     174 
      2     331 
      2     348 
      1     692 
      1     694 


* Write regression tests for cmtree.cxx code ...
    + commit them for sb to poke at ...
	+ link those objs directly ... (?)


--- source/treecache/cachecontroller.cxx	16 Jan 2007 12:18:23 -0000	1.18.24.6
+++ source/treecache/cachecontroller.cxx	7 Feb 2007 10:07:43 -0000
@@ -560,7 +560,9 @@
         addTemplates(backend::ComponentData(aMultiTemplates, aModuleName));
 
     }
+#if defined __GNUC__
 #warning unwind locking implications here too ... 'getTemplateTree' ...
+#endif
     data::TreeAddress aTemplateAddr = m_aTemplates.getTemplateTree(aTemplateLocation);
     if (aTemplateAddr == NULL)
         throw uno::Exception(::rtl::OUString::createFromAscii("Unknown template. Type description could not be found in the given module."), NULL);


