Re: [xslt] Nodeset in extensions



On Sat, Jan 10, 2004 at 07:51:17AM -0800, Jerome Pesenti wrote:
> In str:tokenize the current code goes through some
> trouble to create a new document container for the
> nodeset that is being generated (from what I can tell,
> the container document is added to the context and
> will be cleaned when the context is freed, which means
> that all these containers are accumulated potentially
> creating a memory problem if this function is called
> too many times). So my question is: is that necessary?

  Well read the definition ... Yes crating a new document
is necessary. Yes using extension function like EXSLT
node-set and tokenize can consume a lot of memory. 
  I think the memory allocation is scoped and the 
results are garbage collected. I can't answer for sure,
try with a debugger and follow what's happening if you want a
definitive answer.
  All I can be positive about it is that those extension
function are a PITA w.r.t. memory management, they exhibit
memory allocation behaviour *different* from what could be
expected from XSLT-1.0 in isolation. They have been added
after the design of libxslt, and broke a number of fundamental
assumption, use them at your own risks !

> isn't it possible to create nodesets without container
> documents and if not, couldn't the same "dummy"
> document be reused for all of them?

   No because 
     1/ you don't know the lifetime of said result.
     2/ the content of the document can't be shared between
        extension results.

Maybe I'm wrong. We take patches. Make 100% sure that:
    1/ you compiled libxml2 and libxslt with
       memory debug enabled
    2/ all the regression tests still pass without deviation
       or memory leak

Daniel


-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard@redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]