I have a problem of releasing memory when readin .xml-files using the xml package (version 3.98-1.1, R 3.0.2, Windows 7, 64bit). The problem has appeared previously and several solutions/bug fixes have been proposed, also on stackoverflow. I went through many of these and have also read (and understood?) Duncan Lang`s Memory Management page, outlining the counter-based memory release for nodes and documents. However, the problem persists, i.e.,
pathed<- ... # path to a PubChem .xml file
doc<-xmlTreeParse(file=pathed,useInternalNodes=TRUE)
get_data<-getNodeSet(doc,path="//r:PC-InfoData",
c(r = "http://www.ncbi.nlm.nih.gov")
)
will not allow me to release "doc" from memory using any combinations and different ordering of rm(), free(), gc() for doc and get_data. I ended up using .Call("RS_XML_forceFreeDoc", doc) and monitoring the counter settings with .Call("R_getXMLRefCount", ...) - but that cannot really be the solution, not?
What am I doing wrong? Thank you very much for your help ...