# Changes to extension functions

A new extension function `discard-document` has been added. This takes a document node as its argument and returns the same document node as its result. The function causes the document to be removed from Saxon's internal document pool, which enables the Java garbage collector to release the memory occupied by the document when it is no longer required. The drawback is that if the same document is loaded again during the same transformation, it will be reparsed from the source text, and different node identifiers will be allocated. The function returns the document node that was supplied as an argument, allowing it to be used in a call such as `select="saxon:discard-document(document('a.xml'))"`.

Next