> I've also seen this on a simple web crawler kind of app, accumulating
> stuff in memory rather than on disk. If it hits the max, I've never
> seen a seg fault, but I've gotten the cleaner abend with message.
P.S. Maybe disregard that example; it has fur on it. Of course
something that accumulates memory indefinitely will eventually (ta da)
exhaust memory. Instead I mean something where memory that apparently
could be freed, isn't, until collect-garbage is called explicitly. So
that something hits the max when it otherwise wouldn't at all.
The cleaner examples are the mail relay shim, and seemingly the Racket
web server.
Again I'll try to come up with some simpler example I hope you can repro.
On Thu, Jul 14, 2011 at 6:03 PM, Greg Hendershott
<greghendershott at gmail.com> wrote:
> I wonder if Jay or whoever was involved with that web server code may
> remember something about this?
>> Anyway I will try to make a simple-as-possible recipe for you.
>> I'd posted on the list a few months ago about a simple mail relay
> "shim" I'd deployed that segfaulted. As best I could figure out, that
> happened after maxing out memory. After I used "the magic spell", it's
> been coming nowhere near the max, with 30+ days' uptime. I haven't
> needed to restart it except to update it. (Thanks again to those who
> wisely suggested using something like `monit' for belt+suspenders. For
> awhile monit would help by restarting when the memory got too high,
> every few days. But after "the magic spell", the memory consumption is
> almost constant, just the tiniest little leak, and monit's not been
> needed, although I sleep better knowing it's there.)
>> I've also seen this on a simple web crawler kind of app, accumulating
> stuff in memory rather than on disk. If it hits the max, I've never
> seen a seg fault, but I've gotten the cleaner abend with message.
>> I'll try to boil it down to something as simple as I can.
>> On Thu, Jul 14, 2011 at 3:23 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
>> This sounds like a bug. Explicit calls to `collect-garbage' shouldn't
>> be needed for the garage collector to do its job.
>>>> Does anyone know an easy way for me to make the problem happen, so I
>> can see what is going on?
>>>> At Thu, 14 Jul 2011 12:47:54 -0400, Greg Hendershott wrote:
>>> Once upon a time I noticed the Racket web server has a thread that
>>> calls collect-garbage periodically (e.g. every 5 minutes).
>>>>>> I've discovered I need to do the same, for any program that needs to
>>> run for hours or days. Otherwise, the program eventually abends: Out
>>> of memory. Sometimes with a "Racket virtual machine error" message.
>>> This is my experience on both Windows 7 and on Linux, with Racket 5.0
>>> and 5.1.1.
>>>>>> As a result the following has become a "magic spell" I now throw into
>>> such programs:
>>>>>> ;; Make a thread to do garbage collection every 5 minutes.
>>> (thread
>>> (lambda ()
>>> (let loop ()
>>> (sleep (* 5 60))
>>> (collect-garbage)
>>> (loop))))
>>>>>> It seems weird to have such a magic spell, and to know it only from
>>> nosing around the web server source.
>>>>>> Instead, maybe the Racket runtime should do this automatically (at
>>> least by default)? I think that's people would expect coming from some
>>> other language environments with GC (at least it's what I expected).
>>>>>> Or, at least it would be documented that this is by-design (say for
>>> performance reasons, or there's no reasonable default, or whatever),
>>> and that people should use such a magic spell for long-running
>>> systems?
>>> _________________________________________________
>>> For list-related administrative tasks:
>>>http://lists.racket-lang.org/listinfo/users>>>