From: Mark Probert Date: 2005-02-15T12:17:37+09:00 Subject: Re: More on memory and possible leaks ... (longish) Hi .. On Monday 14 February 2005 15:58, Matt Armstrong wrote: > Mark Probert writes: > > I once had a server program that grew continuously to the point of > memory exhaustion until I wrote my own tempfile.rb. Somehow > tempfile's use of delegate.rb caused the script to use gobs of memory. > I never tracked that down, but at the time I remember something about > some internal Ruby data structures never being collected (symbols come > to mind). > Ok, thanks. > > 2. When I use a fork() model, the amount of memory used per-process is > > around 20Mb. Again, this seems to be quite heavy, however, memory usage > > doubles to 40Mb when I capture data in the hashes! > > Very odd. Can you isolate this expensive use of memory into a stand > alone script? > Not really. The script operates in a fairly complex environment. Its job is to telnet to network elements, login, check to see if it is okay to run by running a few commands and examining their output, then gather some other basic data from the nodes. I don't seem to be able to replicate it that easily by using standard socket or telnet. I'll try and build a simulator in the next few days and see if that will help replication. > > Purify/Valgrind is not so useful for Ruby, since Ruby's GC confuses them. > Ok. Do you know of a way that memory can be tracked? Surely there is something that works for a GC language like Smalltalk or C# that could be adapted for Ruby? > > Telling more about your ruby version, and isolating the problem down > to the smallest script that exhibits the problem are both useful. The ruby version is 1.8.x, and, unfortunately, I have the smallest possible script running. The BSN class is not much use to anybody who doesn't have access to a whole bunch of the network elements in question, though. -- -mark. (probertm at acm dot org)