Excessive Memory Usage with libxml



Hi,

I hope this is the right place for this.

I'm writing a markup mangler that I'm using libxml for. Primarily for
speed reasons.

I've got some basic functionality going, it's not finished, and when
I'm doing a benchmark I get some good figures.

I'm using a recursive function to process my data. The general gist
of it is as follows

http://pastie.caboo.se/63584


But...

When I run the benchmark I get weird things happening.

All benchmarks exhibit steadily increasing memory usage until the end
of the benchmark
10000 iterations were fine
very much above this and I started to get

malloc errors
or
segmentation fault


I changed
doc.root.to_s.gsub( /\<\/?#{artificial_root_tag}\>/, "" )

to
doc.root.to_a.join.gsub( /\<\/?#{artificial_root_tag}\>/, "" )

taking a hit on performance, but it allowed me to get through 100,000
iterations.
The memory usage though was stupid at 235Mb Real and 233Mb Virtual

The HTML I am parsing is a fairly small snippet

I'm running on Mac OsX.

Any ideas what and why?
thankyou

Daniel

.



Relevant Pages

  • Re: sparse polynomial arithmetic
    ... Fateman's benchmark, double-precision coefficients (16-bit ... memory usage, then probably the hash table gets resized but the memory ...
    (sci.math.symbolic)
  • Re: Fastcode MM B&V 0.41
    ... > role than the execution order. ... If you leave the system alone, the memory usage scores stays ... Opening up other programs during a benchmark is not ...
    (borland.public.delphi.language.basm)
  • Re: cobol array editing output
    ... some of this was lost in the "benchmark" implementation). ... compile on the Fujitsu NETCOBOL v6 compiler. ... 50,000,000 Iterations ... Add code for RJUST-6, as follows: ...
    (comp.lang.cobol)
  • Re: jruby vs mri memory management
    ... Linux 32bit when we benchmarked the Ruby Quiz #157 submissions, ... was not impressed (I didn't check the memory usage though): ... you just had to launch the benchmark to get it. ... JVM). ...
    (comp.lang.ruby)
  • Re: Fastcode MM B&V 0.41
    ... > As the results grid grows, the memory usage scores of the MMs ... If you run a benchmark batch with MMs in the order BucketMM first ... ...
    (borland.public.delphi.language.basm)

Loading