All Products
Search
Document Center

Alibaba Cloud Linux:What do I do if -ENOMEM errors occur during io_uring creation?

Last Updated:Feb 28, 2026

io_uring is a high-performance asynchronous I/O interface in the Linux kernel. Creating an io_uring instance fails with -ENOMEM for one of two reasons:

  • Insufficient memory or locked memory limits -- the kernel cannot allocate the required locked memory pages.

  • Excessively large queue parameters -- the requested queue depth exceeds available memory.

Insufficient memory or locked memory limits

Cause

The kernel allocates locked (non-swappable) memory pages when creating an io_uring instance. Locked memory stays in physical RAM to ensure high performance and low latency. This allocation fails with -ENOMEM when:

  • The system lacks sufficient physical memory.

  • The user's locked memory limit (max locked memory) is too low, even if total system memory is sufficient.

Diagnosis

Check the current user's resource limits:

ulimit -a

Find the max locked memory field in the output. This value defines the maximum amount of memory the user can lock.

Solution

Run the target program with root privileges to bypass locked memory limits.

On Elastic Compute Service (ECS) instances, escalate to root with sudo:

sudo ./your_program

In container environments, verify that the container has administrator privileges. Running a program as root inside a Docker container can still trigger -ENOMEM errors if the container lacks full host privileges. Add the --privileged flag when starting the container:

docker run --privileged=true your_image
Warning

--privileged=true grants the container nearly all host privileges. Use with caution.

Excessively large queue parameters

Cause

io_uring allocates memory for the submission queue (SQ) and completion queue (CQ) during initialization. Setting a large queue depth (entries) can exhaust available memory and cause an -ENOMEM error.

Solution

Reduce the entries parameter to a value within the allowed memory range. The io_uring_queue_init and io_uring_queue_init_params functions in liburing create io_uring instances:

int io_uring_queue_init(unsigned entries,
                        struct io_uring *ring,
                        unsigned flags);

int io_uring_queue_init_params(unsigned entries,
                               struct io_uring *ring,
                               struct io_uring_params *params);

Lower the entries value until the instance initializes successfully.

Note

To view detailed documentation on these functions, install liburing and open the manual pages:

sudo yum install liburing -y
man io_uring_queue_init