Dementia

Where are my memories?

After last week’s cool segfaults, I now encountered a more subtle problem: a large memory leak. Again, the problem’s cause lies deep within l ibxml-ruby and ruby-xslt.

Take this piece of code:

 
  @xslt = XML::XSLT.new()
  xsl = "/usr/share/xml/docbook/stylesheet/docbook-xsl/fo/docbook.xsl" 
  100.times do 
    @xslt.xsl = xsl
  end

This script manages to fill my 1.5 Gb RAM in less than 30 seconds. One freaking assignment! But it’s not alone on it’s evil quest.

This friend of his does its best, but ‘only’ manages an increase of 500 Mb in 20 seconds:

  xmlparser = XML::Parser.new
  100.times do  
    xmlparser.filename = "temp.xml" 
    xmlparser.parse
  end

Update: Peter, the meta-programming dude from last post, handed me a possible solution: fork everytime the script performs a memory-leaking action, so that at the end of the fork, the memory is freed. Quite a filthy and unsatisfactory solution, yet I’ll have to do with it, thank you Peter.

Varia

  • Patched ActiveMQ (stomp clients could connect without password, patch here)
  • Added rtf support
  • Written minimalistic rails-application to upload and publish docbookfiles
  • Worked on a DocBook extension for retrospectiva

Entries per category

  1. 6 pages are tagged with docpublisher
  2. 4 pages are tagged with documentum
  3. 11 pages are tagged with events
  4. 12 pages are tagged with rails
  5. 24 pages are tagged with ruby