You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Elisha Berns <e....@computer.org> on 2005/09/13 03:51:17 UTC
Question about MemoryManager class
Hi,
I'm trying to understand the MemoryManager class that comes with
XercesC. Basically I would like to know what kinds of allocations is it
optimized for?
I am looking for a memory manager, to use with Xerces and also with the
std::string class and similar string classes that use a custom allocator
that is specifically optimized for string allocations. By that I mean
an allocator that allocates a block of memory for multiple objects
(strings) and by such speeds up allocation/deallocation requests by only
making actual system calls when a new big block is required.
Does this describe the behavior of the Xerces MemoryManager?
Thanks,
Elisha Berns
e.berns@computer.org
tel. (310) 556 - 8332
fax (310) 556 - 2839
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org
Re: Question about MemoryManager class
Posted by Alberto Massari <am...@datadirect.com>.
Hi Elisha,
the MemoryManagerImpl class that is used by default by Xerces is
simply a wrapper for the operator new/delete; you will need to create
and install your own class. As a reference, you can look at the code
of DOMDocumentImpl::allocate.
Hope this helps,
Alberto
At 18.51 12/09/2005 -0700, Elisha Berns wrote:
>Hi,
>
>I'm trying to understand the MemoryManager class that comes with
>XercesC. Basically I would like to know what kinds of allocations is it
>optimized for?
>
>I am looking for a memory manager, to use with Xerces and also with the
>std::string class and similar string classes that use a custom allocator
>that is specifically optimized for string allocations. By that I mean
>an allocator that allocates a block of memory for multiple objects
>(strings) and by such speeds up allocation/deallocation requests by only
>making actual system calls when a new big block is required.
>
>Does this describe the behavior of the Xerces MemoryManager?
>
>Thanks,
>
>Elisha Berns
>e.berns@computer.org
>tel. (310) 556 - 8332
>fax (310) 556 - 2839
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
>For additional commands, e-mail: c-dev-help@xerces.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org
RE: Question about MemoryManager class
Posted by da...@us.ibm.com.
> Dave,
>
> Thanks for the reply. The reason you advise against this is because the
> Xerces MemoryManager is used for all kinds of allocations, not just
> strings?
Every Xerces-C API or object member function that allocates memory has a
MemoryManager parameter. By design, that MemoryManager instance is used
for _every_ allocation.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org
RE: Question about MemoryManager class
Posted by Elisha Berns <e....@computer.org>.
Dave,
Thanks for the reply. The reason you advise against this is because the
Xerces MemoryManager is used for all kinds of allocations, not just
strings?
Elisha
> Providing custom allocators for the standard library is tricky
business,
> depending on your compilers' implementations. Providing an
implementation
> of MemoryManager for Xerces-C that's optimized for string allocations
> would probably not be a good idea.
>
> > Does this describe the behavior of the Xerces MemoryManager?
>
> No.
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> For additional commands, e-mail: c-dev-help@xerces.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org
Re: Question about MemoryManager class
Posted by da...@us.ibm.com.
> I'm trying to understand the MemoryManager class that comes with
> XercesC. Basically I would like to know what kinds of allocations is it
> optimized for?
The MemoryManager class is an abstract base class that allows many
implementations. The default implementation just calls the standard
operator new and operator delete.
> I am looking for a memory manager, to use with Xerces and also with the
> std::string class and similar string classes that use a custom allocator
> that is specifically optimized for string allocations. By that I mean
> an allocator that allocates a block of memory for multiple objects
> (strings) and by such speeds up allocation/deallocation requests by only
> making actual system calls when a new big block is required.
Providing custom allocators for the standard library is tricky business,
depending on your compilers' implementations. Providing an implementation
of MemoryManager for Xerces-C that's optimized for string allocations
would probably not be a good idea.
> Does this describe the behavior of the Xerces MemoryManager?
No.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org