[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Memory leak?

Nate Smith

6/8/2005 2:03:00 PM

Hello,

I get very different results in my program when I add a simple print
statement that makes no changes to the running code. Unfortunately
the algorithm is too involved to post.

Are there any known memory leaks in Ruby 1.8.2? Thanks

Nate



5 Answers

Robert Klemme

6/8/2005 2:18:00 PM

0

Nathan Smith wrote:
> Hello,
>
> I get very different results in my program when I add a simple print

What kind of results? Memory usage? Was this the first output statement
in the whole program? How big were the differences?

You probably created some temporary strings for / during printing and the
GC doesn't collect them immediately.

> statement that makes no changes to the running code. Unfortunately
> the algorithm is too involved to post.
>
> Are there any known memory leaks in Ruby 1.8.2? Thanks

Dunno.

Kind regards

robert

Nate Smith

6/8/2005 2:35:00 PM

0


On Jun 8, 2005, at 10:20 AM, Robert Klemme wrote:

> Nathan Smith wrote:
>
>> Hello,
>>
>> I get very different results in my program when I add a simple print
>>
>
> What kind of results? Memory usage? Was this the first output
> statement
> in the whole program?

I have many print statements, although I'll cut them out to see if
anything changes.

> You probably created some temporary strings for / during printing
> and the
> GC doesn't collect them immediately.

Aye, I thought of that, but the problem is a little deeper than that.
Objects are being created dynamically, and the actual type of the
object that is created changes -- depending on if I put enough print
statements into the code. It looks and smells like a memory leak..... :(

Are there any tools that can verify this? Seems like that would be a
problem, considering that Ruby generally doesn't have memory leaks.
Thanks for your help

Nate



Nate Smith

6/8/2005 2:36:00 PM

0


On Jun 8, 2005, at 10:20 AM, Robert Klemme wrote:

> Nathan Smith wrote:
>
>> Hello,
>>
>> I get very different results in my program when I add a simple print
>>
>
> What kind of results? Memory usage? Was this the first output
> statement
> in the whole program? How big were the differences?
>
> You probably created some temporary strings for / during printing
> and the
> GC doesn't collect them immediately.
>

I'm also going to try out 1.8.3 to see if that resolves anything



Robert Klemme

6/8/2005 2:43:00 PM

0

Nathan Smith wrote:
> On Jun 8, 2005, at 10:20 AM, Robert Klemme wrote:
>
>> Nathan Smith wrote:
>>
>>> Hello,
>>>
>>> I get very different results in my program when I add a simple print
>>>
>>
>> What kind of results? Memory usage? Was this the first output
>> statement
>> in the whole program?
>
> I have many print statements, although I'll cut them out to see if
> anything changes.
>
>> You probably created some temporary strings for / during printing
>> and the
>> GC doesn't collect them immediately.
>
> Aye, I thought of that, but the problem is a little deeper than that.
> Objects are being created dynamically, and the actual type of the
> object that is created changes -- depending on if I put enough print
> statements into the code. It looks and smells like a memory leak.....
> :(

Wait, you say the type of objects changes and call that a memory leak?
This doesn't make sense to me - at least not in the light of the
information you have disclosed so far.

> Are there any tools that can verify this? Seems like that would be a
> problem, considering that Ruby generally doesn't have memory leaks.
> Thanks for your help

Difficult with GC. You could use ObjectSpace to create some statistics
for objects per class or such.

robert

ES

6/8/2005 2:55:00 PM

0


Le 8/6/2005, "Nathan Smith" <nsmith5@nist.gov> a écrit:
>
>On Jun 8, 2005, at 10:20 AM, Robert Klemme wrote:
>
>> Nathan Smith wrote:
>>
>>> Hello,
>>>
>>> I get very different results in my program when I add a simple print
>>>
>>
>> What kind of results? Memory usage? Was this the first output
>> statement
>> in the whole program?
>
>I have many print statements, although I'll cut them out to see if
>anything changes.
>
>> You probably created some temporary strings for / during printing
>> and the
>> GC doesn't collect them immediately.
>
>Aye, I thought of that, but the problem is a little deeper than that.
>Objects are being created dynamically, and the actual type of the
>object that is created changes -- depending on if I put enough print
>statements into the code. It looks and smells like a memory leak..... :(

It really does not seem like a memory leak (although I suppose it
could be one). Perhaps you are thinking of a memory access error
or something like going over an array index in C?

It is really impossible to say what may be going wrong, except for
"remember that everything in Ruby is an expression". Please post
your algo (or a reduced version as long as the error remains) if
you at all can.

>Are there any tools that can verify this? Seems like that would be a
>problem, considering that Ruby generally doesn't have memory leaks.
>Thanks for your help
>
>Nate

E

--
template<typename duck>
void quack(duck& d) { d.quack(); }