# Cap for Buffer Size

**URL:** <https://forum.rclone.org/t/cap-for-buffer-size/9118>\
**Category:** Help and Support\
**Created:** [March 13, 2019, 11:48am UTC](https://forum.rclone.org/t/cap-for-buffer-size/9118 "2019-03-13T11:48:02Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emrah\_Ayyare](https://forum.rclone.org/user_avatar/forum.rclone.org/emrah_ayyare/32/2916_2.png) [@Emrah\_Ayyare](https://forum.rclone.org/u/Emrah_Ayyare)\
**Post date:** [March 13, 2019, 11:48am UTC](https://forum.rclone.org/t/cap-for-buffer-size/9118/1 "2019-03-13T11:48:02Z")

</div>

Hi All,

Is there any setting to set a cap for the buffer-size ?  
I have a 2 GB memory in my VPS and after a while even if i set buffer size as small as1M rclone crashes because the memory is not enough.

Thanks.

---

<div class="post-metadata">

**Author:** ![Animosity022](https://forum.rclone.org/user_avatar/forum.rclone.org/animosity022/32/451_2.png) [@Animosity022](https://forum.rclone.org/u/Animosity022)\
**Post date:** [March 13, 2019, 11:49am UTC](https://forum.rclone.org/t/cap-for-buffer-size/9118/2 "2019-03-13T11:49:30Z")

</div>

You can set buffer size to 0M.

---

<div class="post-metadata">

**Author:** ![Emrah\_Ayyare](https://forum.rclone.org/user_avatar/forum.rclone.org/emrah_ayyare/32/2916_2.png) [@Emrah\_Ayyare](https://forum.rclone.org/u/Emrah_Ayyare)\
**Post date:** [March 13, 2019, 12:35pm UTC](https://forum.rclone.org/t/cap-for-buffer-size/9118/3 "2019-03-13T12:35:54Z")

</div>

i know but i need the buffer.

---

<div class="post-metadata">

**Author:** ![Animosity022](https://forum.rclone.org/user_avatar/forum.rclone.org/animosity022/32/451_2.png) [@Animosity022](https://forum.rclone.org/u/Animosity022)\
**Post date:** [March 13, 2019, 2:51pm UTC](https://forum.rclone.org/t/cap-for-buffer-size/9118/4 "2019-03-13T14:51:28Z")

</div>

I’m not sure what you mean as

```auto
--buffer-size 0M

```

is your flag to set the buffer.

[https://rclone.org/commands/rclone\_mount/#file-buffering](https://rclone.org/commands/rclone_mount/#file-buffering)

---

<div class="post-metadata">

**Author:** ![Emrah\_Ayyare](https://forum.rclone.org/user_avatar/forum.rclone.org/emrah_ayyare/32/2916_2.png) [@Emrah\_Ayyare](https://forum.rclone.org/u/Emrah_Ayyare)\
**Post date:** [March 13, 2019, 2:58pm UTC](https://forum.rclone.org/t/cap-for-buffer-size/9118/5 "2019-03-13T14:58:09Z")

</div>

if you set a buffer size let’s say 10MB, for every open file rclone allocates a memory of 10 MB.  
if rclone opens 100 files , it will use 100 \* 10 = 1000 MB memory and so on. What i need is a cap for the total memory it uses. When the memory reaches the cap, it should release the memory based on LIFO maybe. i need the buffer for the open files so setting it 0 is not a solution for me.

---

<div class="post-metadata">

**Author:** ![Animosity022](https://forum.rclone.org/user_avatar/forum.rclone.org/animosity022/32/451_2.png) [@Animosity022](https://forum.rclone.org/u/Animosity022)\
**Post date:** [March 13, 2019, 3:54pm UTC](https://forum.rclone.org/t/cap-for-buffer-size/9118/6 "2019-03-13T15:54:07Z")

</div>

There is no current way to cap the buffer size.

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [March 13, 2019, 9:37pm UTC](https://forum.rclone.org/t/cap-for-buffer-size/9118/7 "2019-03-13T21:37:22Z")

</div>

> [@Emrah\_Ayyare](#):
>
> if you set a buffer size let’s say 10MB, for every open file rclone allocates a memory of 10 MB.  
> if rclone opens 100 files , it will use 100 \* 10 = 1000 MB memory and so on. What i need is a cap for the total memory it uses. When the memory reaches the cap, it should release the memory based on LIFO maybe. i need the buffer for the open files so setting it 0 is not a solution for me.

It is the application using the mount that opens the files, not rclone. So rclone mount would have to throw errors at that point or stop buffering files.

A total buffer pool allocation might be nice.

Note that you can use `--use-mmap` which makes rclone better at returning memory to the OS.

---

<div class="post-metadata">

**Author:** ![Emrah\_Ayyare](https://forum.rclone.org/user_avatar/forum.rclone.org/emrah_ayyare/32/2916_2.png) [@Emrah\_Ayyare](https://forum.rclone.org/u/Emrah_Ayyare)\
**Post date:** [March 13, 2019, 10:23pm UTC](https://forum.rclone.org/t/cap-for-buffer-size/9118/8 "2019-03-13T22:23:12Z")

</div>

Yes the application i use try to open as many files as it can. So after while it causes rclone to crash if the buffer-size is greater than 0. It would be great to have a total pool allocation. I also tried --use-mmap but result is the same.

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [March 14, 2019, 8:46pm UTC](https://forum.rclone.org/t/cap-for-buffer-size/9118/9 "2019-03-14T20:46:51Z")

</div>

Can you set a ulimit on your application?

`ulimit -n` will limit number of open files.

---

<div class="post-metadata">

**Author:** ![Emrah\_Ayyare](https://forum.rclone.org/user_avatar/forum.rclone.org/emrah_ayyare/32/2916_2.png) [@Emrah\_Ayyare](https://forum.rclone.org/u/Emrah_Ayyare)\
**Post date:** [March 15, 2019, 12:59am UTC](https://forum.rclone.org/t/cap-for-buffer-size/9118/10 "2019-03-15T00:59:14Z")

</div>

i will check it.

---

<div class="post-metadata">

**Author:** ![system](https://forum.rclone.org/uploads/default/original/2X/3/39ad3235f6ffec76ccd0c81616bd55697b4c300d.png) [@system](https://forum.rclone.org/u/system)\
**Post date:** [June 13, 2019, 12:59am UTC](https://forum.rclone.org/t/cap-for-buffer-size/9118/11 "2019-06-13T00:59:17Z")

</div>

Closed on June 13, 2019, 12:59am UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
