On 2005-01-25 23:49, Michael Neumann wrote:
> Torsten Senf wrote:
> >Hi,
> >
> >I use a simple XML-RPC Server, which should print out Content from some 
> >Files via XML-RPC. Here is the source of the server:
> >
> >require "xmlrpc/server"
> >
> >s = XMLRPC::Server.new(port="8080")
> >
> >class MyFile
> >  
> >  # shows only the tail of the file
> >  def showlog(a)
> >    line_a = []
> >    f = File.open(a,"r")
> >    f.seek(-100, IO::SEEK_END)
> >    f.seek(-30000, IO::SEEK_CUR)
> >    line_a = f.readlines.reverse
> >    f.close
> >    return line_a
> >  end 
> >  
> >  # shows the whole file	
> >  def showconfig(a)
> >    f = File.open(a,"r")
> >    f_a = f.readlines
> >    f.close
> >  return f_a
> >  end
> >end
> >
> >
> >s.add_handler("file", MyFile.new)
> >
> >s.serve
> >
> >The problem is now, when I call the server, it gives the contents of the
> >files (ok), but the memory usage of the process increases from call to call
> >and the memory would not be get free. I have no idea why. How can I
> >guarantee, that the memory usage from the server will be decreased after
> >calling a methode via XML RPC? 
> 
> You could insert GC.start, which invokes the garbage-collector. Is 
> memory consuption increasing monotonically, or does it increase and then 
> stay stable? If the first case applies, you (or XML-RPC) has a memory leak.
> 

The memory increasing monotonically. Where can be the memory leak? In my
above short code? 

Torsten Senf