You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by "Scurr, Robert" <ro...@csfb.com> on 2002/08/27 12:57:28 UTC

FW: xalan and threads

As suggested - I am moving this to the Xalan c users distribution list.

I will think about implementing the pool of factory classes as suggested.  Is it not a bit surprising, however, that there is so much dynamic memory allocation on the heap, that it is blocking threads ?  I'm sure Solaris memory management is fairly efficient.

I'm a bit nervous at making the change, and not fixing the problem - if you see what I mean!

-----Original Message-----
From: David N Bertoni/Cambridge/IBM [mailto:david_n_bertoni@us.ibm.com]
Sent: 23 August 2002 19:20
To: Scurr, Robert
Subject: RE: xalan and threads







----- Forwarded by David N Bertoni/Cambridge/IBM on 08/23/2002 11:19 AM
-----
                                                                                                                                        
                      David N                                                                                                           
                      Bertoni/Cambridge         To:      xalan-dev@xml.apache.org                                                       
                      /IBM                      cc:      (bcc: David N Bertoni/Cambridge/IBM)                                           
                      <david_n_bertoni@         Subject: RE: xalan and threads                                                          
                      us.ibm.com>                                                                                                       
                                                                                                                                        
                      08/23/2002 08:19                                                                                                  
                      AM                                                                                                                
                      Please respond to                                                                                                 
                      xalan-dev                                                                                                         
                                                                                                                                        
                                                                                                                                        







> Unfortunately it's a bit late for that!
>
> I have had more of a look at the way we're using Xalan and found out that
we are creating and deleting:
>
> XObjectFactoryDefault and XPAthFactoryDefault
>
> for every message that we process in every single thread.  Now I'm
assuming Xalan has some
> sort of caching within XObjectFactoryDefault, and that all requests for
Xalan memory
> allocations go through this factory.  Therefore deleting this factory
each time we process
> a message on each thread cannot be taking much advantage of this cache.

Yes, those, and many other Xalan classes, cache things to take as much
strain off of the heap allocator as possible.  If you re-use
XObjectFactoryDefault, XPathFactoryDefault, and
XPathExecutionContextDefault instances, you will greatly reduce the number
of dynamic memory allocations.  If you look at the source code, you'll also
see that those classes use block allocation strategies to further reduce
memory allocations.  In fact, very few Xalan classes make individual heap
allocations, for this very reason.

> I am therefore trying to promote these two factories to a singleton
class, so that there is
> only ever one instance of them per process.  Then all the threads can
benefit from this cache.
> I'm not sure however, how thread-safe XObjectFactoryDefault is.

It's not thread-safe at all -- the documentation makes this clear.  You
probably want a pool of instances that you can distribute to threads, and
that they return when they're finished with them.

You haven't said what your application does, but you might want to take a
look at the class XPathEvaluator, which encapsulates these factories for
you.  Also, you should make absolutely sure you're using Xalan's default
source tree implementation, and not the Xerces DOM.

You might consider moving this to the Xalan-C user list, as that's a more
appropriate venue for the discussion.

Dave




This message is for the named person's use only. It may contain sensitive and private proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you are not the intended recipient, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. CREDIT SUISSE GROUP and each legal entity in the CREDIT SUISSE FIRST BOSTON or CREDIT SUISSE ASSET MANAGEMENT business units of CREDIT SUISSE FIRST BOSTON reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity.
Unless otherwise stated, any pricing information given in this message is indicative only, is subject to change and does not constitute an offer to deal at any price quoted. Any reference to the terms of executed transactions should be treated as  preliminary only and subject to our formal written confirmation.