How to reclaim memory without GC.start

A

Ari Brown

Why oh why are you asking for this, Ari?

This can be of great use for computers with low memory - You run this
script, it uses up all available memory, and then it exits. Guess
what happens then? GC clears out all of the RAM the ruby script was
using. And since it was using up all available RAM, other programs
can then run better and faster.

You see? Its not malicious!


-------------------------------------------------------|
~ Ari
crap my sig won't fit
 
L

Lionel Bouton

Ari said:
This can be of great use for computers with low memory - You run this
script, it uses up all available memory, and then it exits. Guess what
happens then? GC clears out all of the RAM the ruby script was using.
And since it was using up all available RAM, other programs can then
run better and faster.

At this moment, other programs have been painfully pushed to swap, so
they have to get out of swap before doing anything. If you want to solve
a memory management problem, don't use a program, tune your kernel (or
swap the OS for another if it's unable to do memory management properly,
Ruby works on a large choice of OS...).

Lionel
 
T

Todd Benson

This can be of great use for computers with low memory - You run this
script, it uses up all available memory, and then it exits. Guess
what happens then? GC clears out all of the RAM the ruby script was
using. And since it was using up all available RAM, other programs
can then run better and faster.

OK. I might be using up my credibility here, but ...

/memory/intelligence/
You see? Its not malicious!

That's not my intention either. The only thing that comes to mind is
"shooting themselves in the foot"?

Point being: yes, it is useful to be destructive in order to be
productive. But, do you really have to?

Todd
 
A

Ari Brown

On Aug 6, 2007, at 1:34 PM, Todd Benson wrote:
OK. I might be using up my credibility here, but ...

/memory/intelligence/


That's not my intention either. The only thing that comes to mind is
"shooting themselves in the foot"?

Point being: yes, it is useful to be destructive in order to be
productive. But, do you really have to?

Well, no, I don't have to, but it would be really nice to be able to
have a bunch of free memory so my computer doesn't stall during
another program. Is there an alternative to soaking up the RAM and
then releasing it?

-------------------------------------------------------|
~ Ari
crap my sig won't fit
 
A

ara.t.howard

Well, no, I don't have to, but it would be really nice to be able
to have a bunch of free memory so my computer doesn't stall during
another program. Is there an alternative to soaking up the RAM and
then releasing it?

check out /dev/shm or mmap. to allocate a big string just use

huge = 0.chr * (2 ** 32)

regards.

a @ http://drawohara.com/
 
J

John Joyce

On Aug 6, 2007, at 1:34 PM, Todd Benson wrote:


Well, no, I don't have to, but it would be really nice to be able
to have a bunch of free memory so my computer doesn't stall during
another program. Is there an alternative to soaking up the RAM and
then releasing it?

-------------------------------------------------------|
~ Ari
crap my sig won't fit
It's just generally accepted that the Berkeley and MIT crowd have
figured out memory management well enough at the OS level. The best
way to free up additional memory is to run fewer apps at the same
time and tweak the OS to run less stuff in the background.

One aspect of memory management, however, is that there is just a
limit to how many apps can run smoothly at the same time on the same
machine. Even with lots of memory, you still run into limits on the
processor.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,266
Messages
2,571,318
Members
47,998
Latest member
GretaCjy4

Latest Threads

Top