[
https://issues.apache.org/jira/browse/XERCESC-1730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12572089#action_12572089
]
Alberto Massari commented on XERCESC-1730:
------------------------------------------
I am not sure that adding such a method to the interface fixes the problem; you
still need to write some special code to make it work (create a memory manager
that overrides the method, set the pointer to the proper exception memory
manager - you will not want to always use the global one - and ensure that that
memory manager is still valid when catching the exception).
I would rather invest in allowing the exceptions to be migrated from one memory
manager to another, e.g. by adding a setMemoryManager() to be called inside a
catch(XMLException&) before rethrowing the same execption (if needed)
> scoped memory management
> ------------------------
>
> Key: XERCESC-1730
> URL: https://issues.apache.org/jira/browse/XERCESC-1730
> Project: Xerces-C++
> Issue Type: Improvement
> Reporter: Tobias Schuette
> Priority: Minor
> Fix For: 3.0.0
>
> Attachments: MemoryManager.diff, XMLException.diff
>
>
> passing scoped memory managers to certain helper functions (xercesc/util/...)
> only works in non-exceptional or catch-all circumstances.
> If those functions (e.g. XMLString::parseInt) throw an exception the scoped
> memory manager
> is passed via ThrowXMLwithMemMgrXXX to the exception during construction.
> The exception allocates memory for its internal buffers (message/source file)
> from that memory manager.
> If the exception is not caught before the scoped memory manager goes
> out-of-scope,
> dereferencing/deallocating the memory during reporting/destruction yields
> undefined behaviour.
> the attached diffs against trunk are a proposal to change the MemoryManager
> interface of Xerces-C's pluggable memory management and the exception base
> class XMLException in such a way that implementors of the MemoryManager
> interface are able to handle memory requests coming from exceptions
> separately as discussed on the mailing-list.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]