Forum OpenACS Development: Re: HEAD install.xml feature is broken

Collapse
Posted by Bart Teeuwisse on
Randy,

without having had the chance to look at the creation of the DOM tree for install.xml, my guess is that tDOM didn't create a persistent DOM.

If the tDOM parses xml like so:

    dom parse $xml doc
    $doc documentElement root

then the DOM tree and the associated Tcl command object (document and all node objects) are freed automatically when doc gets freed. Which happens at the end of index.tcl.

Use the following form instead.

    set doc [dom parse $xml]
    set root [$doc documentElement]

parses the XML in the variable xml, creates the DOM tree in memory, make a reference to the document object, visible in Tcl as a document object command, and returns this new object name, which is then stored in doc. To free the underlying DOM tree and the associative Tcl object commands (document + nodes + fragment nodes) the document object command has to be explicitly deleted by:

  $doc delete

or

  rename $doc ""

Using this form you can pass doc around, but don't forget to delete doc or you'll create a memory leak.

/Bart