From: Jan Svitok Date: 2007-01-04T01:54:33+09:00 Subject: Re: Memory Leak Madness On 1/3/07, Brandon Casci wrote: > Here is what my daemon does.... > It has a couple threads, Thread1 one gets work, and Thread2 performs > work > > Thread 1: > > -Thread1 gets rows from a database every N seconds > -it builds a series of objects based on the database rows, and appends > them to an array. They are called "work items". The array is protected > by a mutex-sync because Thread2 picks items off of it. > -it sleeps for a while then repeats the process > > Thread 2: > > - Thread two gets a "work item" from the above array. An item is > "popped" off the array by calling .shift from within a mutex-sync block > - Hpricot pulls information down from url's inside the "work item" > - the information gets put put into hashes, which get dumped to disk via > YAML::dump Sometime ago there was a problem with Array#shift leaking memory. The proposed solution that time was to replace push/shift pairs with unshift/pop (i.e. entering the data in the opposite direction). I think it should be fixed now, but I'm not sure (1.8.5-p0 had this bug, maybe 1.8.5-p2 doesn't).