Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #4689 > unrolled thread

Re: Manual Memory Management and Automatic Garbage Collection

Started byTridib Bandopadhyay <tridib04@gmail.com>
First post2011-05-17 14:58 -0500
Last post2011-05-19 02:44 -0500
Articles 6 — 4 participants

Back to article view | Back to comp.lang.ruby

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Manual Memory Management and Automatic Garbage Collection Tridib Bandopadhyay <tridib04@gmail.com> - 2011-05-17 14:58 -0500
    Re: Manual Memory Management and Automatic Garbage Collection Robert Klemme <shortcutter@googlemail.com> - 2011-05-18 02:12 -0500
      Re: Manual Memory Management and Automatic Garbage Collection Tridib Bandopadhyay <tridib04@gmail.com> - 2011-05-18 17:43 -0500
        Re: Manual Memory Management and Automatic Garbage Collection Phillip Gawlowski <cmdjackryan@googlemail.com> - 2011-05-18 18:18 -0500
        Re: Manual Memory Management and Automatic Garbage Collection JK Victor <johnkvictor@yahoo.com> - 2011-05-18 18:50 -0500
        Re: Manual Memory Management and Automatic Garbage Collection Robert Klemme <shortcutter@googlemail.com> - 2011-05-19 02:44 -0500

#4689 — Re: Manual Memory Management and Automatic Garbage Collection

FromTridib Bandopadhyay <tridib04@gmail.com>
Date2011-05-17 14:58 -0500
SubjectRe: Manual Memory Management and Automatic Garbage Collection
Message-ID<313bbaeb2103f9ad4323556c4fc5730f@ruby-forum.com>
I have some questions::--

1. Is it possible to Manually free memory(without calling GC.start) by 
extending it with C? As i have tried it and its of no use for my work.

2. Can I add a new file and try to manually free memory(disabling GC)?

Regards

Tridib

-- 
Posted via http://www.ruby-forum.com/.

[toc] | [next] | [standalone]


#4722

FromRobert Klemme <shortcutter@googlemail.com>
Date2011-05-18 02:12 -0500
Message-ID<BANLkTi=NknK1176QkM=0Wo=ThHSw+KD_1w@mail.gmail.com>
In reply to#4689
On Tue, May 17, 2011 at 9:58 PM, Tridib Bandopadhyay <tridib04@gmail.com> wrote:
> I have some questions::--
>
> 1. Is it possible to Manually free memory(without calling GC.start) by
> extending it with C? As i have tried it and its of no use for my work.
>
> 2. Can I add a new file and try to manually free memory(disabling GC)?

I am sure, both can be achieved with an amount of hacking Ruby's
source code.  So: yes and yes.

What I do not understand: what is the aim of your research?  I mean,
people have spent numerous hours of research and engineering to make
automatic GC work, and you seem to be mainly concerned with adding
manual memory management to a language which has automatic GC.  What
is the point of your research?

Kind regards

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

[toc] | [prev] | [next] | [standalone]


#4746

FromTridib Bandopadhyay <tridib04@gmail.com>
Date2011-05-18 17:43 -0500
Message-ID<ea7db33bcdb5c9faf62bd9581c3443a3@ruby-forum.com>
In reply to#4722
Robert K. wrote in post #999427:
> On Tue, May 17, 2011 at 9:58 PM, Tridib Bandopadhyay
> <tridib04@gmail.com> wrote:
>> I have some questions::--
>>
>> 1. Is it possible to Manually free memory(without calling GC.start) by
>> extending it with C? As i have tried it and its of no use for my work.
>>
>> 2. Can I add a new file and try to manually free memory(disabling GC)?
>
> I am sure, both can be achieved with an amount of hacking Ruby's
> source code.  So: yes and yes.

What do you mean by Hacking Ruby's Code... I didn't get it.. Can you
describe me in Detail.

>
> What I do not understand: what is the aim of your research?  I mean,
> people have spent numerous hours of research and engineering to make
> automatic GC work, and you seem to be mainly concerned with adding
> manual memory management to a language which has automatic GC.  What
> is the point of your research?
>
> Kind regards
>
> robert


Yeah i know that.. But since Ruby is Using Stop the World concept. So I
was thinking of not letting the GC to come and free memory every time
for small objects,Stopping the code. So I just want to check if it can
be helpful or not...

Thanks...

Regards

Tridib

-- 
Posted via http://www.ruby-forum.com/.

[toc] | [prev] | [next] | [standalone]


#4747

FromPhillip Gawlowski <cmdjackryan@googlemail.com>
Date2011-05-18 18:18 -0500
Message-ID<BANLkTinO9R1pAZ72cBsRS3KGVfOGQFAOLw@mail.gmail.com>
In reply to#4746
On Thu, May 19, 2011 at 12:43 AM, Tridib Bandopadhyay
<tridib04@gmail.com> wrote:
>
> What do you mean by Hacking Ruby's Code... I didn't get it.. Can you
> describe me in Detail.

% svn co http://svn.ruby-lang.org/repos/ruby/trunk ruby
% cd ruby
% vim ruby.c gc.c
# modify Ruby's source code here.

> Yeah i know that.. But since Ruby is Using Stop the World concept. So I
> was thinking of not letting the GC to come and free memory every time
> for small objects,Stopping the code. So I just want to check if it can
> be helpful or not...

Then start looking at other GC systems that are used by other
languages. You don't know if you can improve Ruby's GC if you don't
know about other GCs, and how they are implemented, no?

-- 
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.

[toc] | [prev] | [next] | [standalone]


#4749

FromJK Victor <johnkvictor@yahoo.com>
Date2011-05-18 18:50 -0500
Message-ID<e086cab0e96df5353bb1cb4b5a0121a6@ruby-forum.com>
In reply to#4746
Tridib Bandopadhyay wrote in post #999550:
> So I
> was thinking of not letting the GC to come and free memory every time
> for small objects,Stopping the code. So I just want to check if it can
> be helpful or not...

Ruby has a very primitive conservative GC -- it just scans the stack 
looking for pointers. If you are a time traveler from the 1950s then 
Ruby's GC might be an interesting study.

In any case it would be easy to fool Ruby's GC, if that's what you wish: 
allocate a pointer and hide data behind the pointer. The GC won't see 
pointers which aren't on the stack. You can manage that GC-concealed 
data however you like.

-- 
Posted via http://www.ruby-forum.com/.

[toc] | [prev] | [next] | [standalone]


#4756

FromRobert Klemme <shortcutter@googlemail.com>
Date2011-05-19 02:44 -0500
Message-ID<BANLkTin=xAr5pK72dp_vo9g+UXj1rp0jDQ@mail.gmail.com>
In reply to#4746
On Thu, May 19, 2011 at 12:43 AM, Tridib Bandopadhyay
<tridib04@gmail.com> wrote:
> Robert K. wrote in post #999427:
>> On Tue, May 17, 2011 at 9:58 PM, Tridib Bandopadhyay
>> <tridib04@gmail.com> wrote:
>> What I do not understand: what is the aim of your research?  I mean,
>> people have spent numerous hours of research and engineering to make
>> automatic GC work, and you seem to be mainly concerned with adding
>> manual memory management to a language which has automatic GC.  What
>> is the point of your research?

> Yeah i know that.. But since Ruby is Using Stop the World concept. So I
> was thinking of not letting the GC to come and free memory every time
> for small objects,Stopping the code. So I just want to check if it can
> be helpful or not...

Did you mean to include manual cleanup of particular instances which
are known to be not used any more (e.g. when a method is left)?  In
that case keep in mind that it is hard to know which objects can be
collected because you do not know what other objects local variable
hold or create and you also do not know whether references of objects
in local variables are published somewhere else so they have to live
longer than the stack frame where their local variable reference is
stored.

Cheers

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.ruby


csiph-web