# rtorrent: read and write errors

## Bigun

I'm hosting about 130 files via rtorrent on a 50 Mbps pipe on a 3Tb software raid, the machine in question is running a very minimal setup and has 1Gb of RAM.  Every once in a while torrents start popping up with these errors:

```
Storage error: [File chunk write error: Cannot allocate memory.]
```

or

```
Storage error: [File chunk read error: Cannot allocate memory]
```

Any help would be appreciated.

----------

## eccerr0r

Are you just seeding or also leeching?

I can see leeching becoming an issue as it has to allocate a large chunk buffer for each receiving chunk from each computer... depending on number of peers sending chunks to you, it can use up quite a bit of RAM.

Reading, it probably would be a poor software choice to read a chunk in just to seed it, since the OS can already do it (unless you don't trust OS caching, then you need even more RAM)

but this is just a guess...

----------

## Yuu

Hi,

depending on the size of the files that you're leeching, rTorrent can eat a lot of memory (for large files); but while seeding, it has a low ram usage. Maybe you can tweak your ~/.rtorrent.rc and lower some values like send_buffer_size, receive_buffer_size, min_peers and max_peers.

Here is my 256Mb ram usage setup, if it can help : 

```

dht = disable

download_rate = 0

upload_rate = 100

directory = /home/<your-user>/data/

session = /home/<your-user>/session/

port_range = 6881-6881

port_random = no

check_hash = no

max_memory_usage = 256M

send_buffer_size = 2M

receive_buffer_size = 4M

#no encrytion : encryption = allow_incoming,enable_retry,prefer_plaintext

encryption = require,allow_incoming,require_RC4

tracker_numwant = 100

use_udp_trackers = no

min_peers = 40

max_peers = 80

min_peers_seed = 40

max_peers_seed = 80

max_uploads = 10

# enable default ratio group.

ratio.enable=

# large torrents will stop at ratio 7.0, and small torrents (<20M)at ratio 2.0

ratio.min.set = 200

ratio.max.set = 700

ratio.upload.set = 20M

# Changing the command triggered when the ratio is reached.

system.method.set = group.seeding.ratio.command, d.close=
```

Also, maybe you can check the man page.

Good luck finding your best values  :Smile: 

----------

## Bigun

I'm only seeding data, about 98% of the time.

My file sizes vary from 50 Mb to about 250 Gb.

I'll play with the values and see what I can do.

----------

