# Limit clamav memory usage



## elimelech007 (Jan 29, 2022)

How to Limit Memory Usage
clamav-clamd?


For example up to 512 megabytes


----------



## Phishfry (Jan 30, 2022)

ClamAV operates as a user:

```
clamav:*:106:106:Clamav Antivirus:/nonexistent:/usr/sbin/nologin
```
Maybe you could limit memory to this user.


----------



## Phishfry (Jan 30, 2022)

rctl(8)
					






					www.freebsd.org
				



`rctl -a user:clamav:vmemoryuse:deny=512M`


----------



## elimelech007 (Jan 30, 2022)

These settings will be saved after reboot.


----------



## grahamperrin@ (Jan 30, 2022)

elimelech007 said:


> These settings will be saved after reboot.



If written to persistent storage, I assume so. 

rctl.conf(5)


----------



## elimelech007 (Jan 30, 2022)

Didn't work, says:

```
ibClamAV Error: mpool_malloc(): Can't allocate memory (16781312 bytes).
LibClamAV Error: mpool_malloc(): Can't allocate memory (16781312 bytes).
LibClamAV Error: mpool_malloc(): Can't allocate memory (16781312 bytes).
LibClamAV Error: mpool_malloc(): Can't allocate memory (16781312 bytes).
LibClamAV Error: mpool_malloc(): Can't allocate memory (16781312 bytes).
LibClamAV Error: mpool_malloc(): Can't allocate memory (16781312 bytes).
LibClamAV Error: mpool_malloc(): Can't allocate memory (16781312 bytes).
LibClamAV Error: mpool_malloc(): Can't allocate memory (16781312 bytes).
LibClamAV Error: mpool_malloc(): Can't allocate memory (16781312 bytes).
LibClamAV Error: mpool_malloc(): Can't allocate memory (16781312 bytes).
LibClamAV Error: mpool_malloc(): Can't allocate memory (16781312 bytes).
LibClamAV Error: mpool_malloc(): Can't allocate memory (16781312 bytes)
```


----------



## chungy (Jan 30, 2022)

It did work, but ClamAV didn't like the restriction.


----------



## eternal_noob (Jan 30, 2022)

The minimum recommended RAM for ClamAV is

FreeBSD and Linux server edition: 2 GiB+
Linux non-server edition: 2 GiB+
Windows 7 & 10 32-bit: 2 GiB+
Windows 7 & 10 64-bit: 3 GiB+
macOS: 3 GiB+






						Introduction - ClamAV Documentation
					

An open source malware detection toolkit and antivirus engine.




					docs.clamav.net


----------



## grahamperrin@ (Jan 30, 2022)

elimelech007 said:


> How to Limit Memory Usage …



A sincere question: why?

Is there, for example, a problem with overall performance of the system with scanning at a particular time of day?


----------

