CPU and Memory limits

Hi,
How to limit memory and cpu for containers in drone 1.0.0-rc1?
Thanks

Memory limit in .drone.yml
resources:
limits:
memory: 600M

I hit memory problem. I need at least 4G virtual memory. Is the receipe above still working for docker runners?

The error I have is:
465 CMakeFiles/xxx.make:1234: recipe for target ‘CMakeFiles/xxxe.cpp.o’ failed
466 virtual memory exhausted: Cannot allocate memory
467 make[2]: *** [CMakeFiles/xxx.o] Error 1

The configuration syntax in this thread is used to limit memory, not to allocate memory. Docker containers have access to unlimited memory by default and are only subject to limits imposed by the process manager or host machine operating system.

1 Like

Hi how to debug this? Thanks for the help!
when I run docker inspect <container_id>, I saw like this:
“Env”: [
“DRONE_MEMORY_LIMIT=8000000000”,
“DRONE_PLATFORM_OS=linux”,
“DRONE_PLATFORM_ARCH=amd64”

Is it possible you are running concurrent builds on the same machine and are exhausting memory resources? If your builds are resource intensive you should consider lowing the maximum number of pipelines that can run in parallel on a single machine, and install runners on multiple machines for increased parallelism.

also this might help if you are testing this on docker for mac / windows (this may not be relevant)

It turns out build passed on 8G memory machine. so it is somehow physical memory issue but reported as virtual memory. I don’t know why there is such a thing as physical memory is kind invisible to the docker machine