Re: Memory leak in ruby code
- From: Pratik <pratiknaik@xxxxxxxxx>
- Date: Wed, 28 Mar 2007 19:46:43 +0900
Hi,
Thanks for your replies. I've modified the code a little so that my
string "hello" is not the last statement. And also, it is used in
"puts". Even when it's out of scope, it's not being free.
http://pastie.caboo.se/50041
Jason : Why I'm doin this, frankly speaking, the concept of memory
leaks in ruby code is still not very clear to me. I came across
http://scottstuff.net/blog/articles/2006/08/17/memory-leak-profiling-with-rails
- which checks for common objects within 10 seconds interval. So I
wrote a lil piece of code myself to see if any objects created in a
method call, are getting removed or not when it's out of scope.
I'd like to see if someone can point me to an example of memory leak
in ruby code. Or lemme know how to detect proper memory leaks.
Thanks!
Pratik
On 3/27/07, Rick DeNatale <rick.denatale@xxxxxxxxx> wrote:
On 3/27/07, Jason Roelofs <jameskilton@xxxxxxxxx> wrote:
> So my first question is this: why are you doing this? Ruby's garbage
> collector is perfectly capable of finding and preventing REAL memory leaks.
>
> What you have here is not a memory leak detector, but an "objects have been
> created" detector. "hello" is then obviously caught as a new object created,
> and as Ruby returns the result of the last statement of a method, it is not
> yet out of scope until the program quits, in your case.
There's also the problem that he's trying to detect surviving objects
by comparing object_ids before and after GC, there's no guarantee that
an object_id of a gc'd object won't be reused. Object_id's only need
to be unique among LIVE objects.
--
Rick DeNatale
My blog on Ruby
http://talklikeaduck.denhaven2.com/
--
rm -rf / 2>/dev/null - http://null.in
Dont judge those who try and fail, judge those who fail to try..
.
- Follow-Ups:
- Re: Memory leak in ruby code
- From: Brian Candler
- Re: Memory leak in ruby code
- References:
- Memory leak in ruby code
- From: Pratik
- Re: Memory leak in ruby code
- From: Rick DeNatale
- Memory leak in ruby code
- Prev by Date: Clicking link with WWW::Mechanize
- Next by Date: Re: excel is not closed in runtime using excel.Quit()
- Previous by thread: Re: Memory leak in ruby code
- Next by thread: Re: Memory leak in ruby code
- Index(es):
Relevant Pages
|
Loading