Xiaomi magazine buffer: what size to put for the correct operation of the system?

Why You Need a Xiaomi Magazine Buffer and Why Its Size Is Important

Log Buffer is a critical component of the MIUI operating system that is responsible for temporarily storing system logs, applications, and the kernel. These logs are used to diagnose crashes, debug errors, and even restore the device after critical errors. However, many users of Xiaomi, Redmi or POCO face the problem that an incorrectly selected buffer size can lead to a slowdown, loss of important logs, or even the inability to record new events.

In this article, we will look at how the log buffer size is optimal for different use cases, how to change it and what errors users most often make. It is important to understand that there is no universal solution - the choice depends on the device model, the version of MIUI, and even whether you use custom firmware or modified cores.

If youโ€™ve ever seen logbuffer: buffer overflow in your logs, the buffer size is too small for your load, and an overly large buffer can take up precious RAM, which is especially critical on devices with 2-4 GB of RAM.

How the journal buffer works in MIUI: technical details

In Android systems, including MIUI, the log buffer is implemented as a ring buffer in RAM. When the buffer is filled, new entries overwrite old, unless otherwise configured, behaviors.

  • ๐Ÿ“ฑ Linux kernel โ€“ responsible for low-level logs (kernel log, dmesg).
  • ๐Ÿค– Android Logger โ€“ manages application logs (logcat).
  • ๐Ÿ”„ MIUI Log Service โ€“ an additional layer that can duplicate or filter logs.
  • ๐Ÿ’พ Permanent Logs โ€“ Part of the logs are stored in the /data/log post-reboot diagnostics.

By default, Xiaomi sets the log buffer size between 256-512 KB for logcat and 128-256 KB for kernel log.

  • ๐Ÿ“ฒ Device models (e.g., Xiaomi 13 Pro has a larger buffer than Redmi Note 10).
  • ๐Ÿ”„ Versions MIUI (into MIUI 14 Logs Optimized Better Than in the Internet MIUI 12).
  • ๐Ÿ› ๏ธ Availability of Root Rights or Custom Recaveri (TWRP, OrangeFox).
๐Ÿ“Š What kind of firmware do you use on Xiaomi?
Stock MIUI
Custom (LineageOS, Pixel Experience, etc.)
MIUI with root rights
I don't know.

If you are actively using debugging tools (ADB, MatLog, Logcat Extreme), a standard buffer size may not be enough, in which case logs will be cut off and you will lose important crash information.

Optimal magazine buffer sizes for different Xiaomi devices

The choice of buffer size depends on several factors: RAM, MIUI version and usage goals. Below is a table with recommended values for different categories of devices.

Category of deviceRAMRecommended Logcat SizeRecommended size of kernel logNotes
Redmi Note 8/9/10, POCO M3/M43-4 GB512 KB - 1 MB256 KBAn increase of more than 1 MB can cause lags.
Xiaomi 11 Lite, Redmi K40, POCO F36-8 GB1-2 MB512 KBOptimal for debugging and moderate logging.
Xiaomi 12/13, Redmi K50, POCO F4 GT8-12 GB2-4 MB1 MBBSuitable for intensive debugging and moding.
Xiaomi Mix Fold, Black Shark12+GB4-8MB2 MBBMaximum values for professional diagnostics.
Custom firmware devicesAnybody.1-16 MB1-4 MBDepends on the kernel and settings of init.rc.

Critical note: on devices with 2-3 GB of RAM, an increase in buffers above 1 MB can lead to forced closure of background applications due to memory shortage.

๐Ÿ’ก

If you are developing or testing applications, set the logcat size at least 4 MB. This will save logs for several hours of work.

How to change the size of the magazine buffer on Xiaomi

There are several ways to change the size of the log buffer, and the method you choose depends on whether you have root rights and what type of buffer you want to modify.

Method 1: Through ADB (no root rights)

This method allows you to temporarily resize the logcat buffer before restarting the device.

  1. Connect your device to your PC and enable USB Debugging in Settings โ†’ About Phone โ†’ MIUI version (click 7 times to activate Developer Mode).
  2. Open the command line and type: adb shell su logcat -G 4M Here 4M is the desired size (you can specify 512K, 1M, etc.).
  3. Check the current size: logcat -g

โš ๏ธ Warning: After the device is restarted, the buffer size will reset to the default value. Root rights are required to permanently change.

Method 2: Edit init.rc (root required)

To permanently resize the buffer, you need to edit the file /init.rc or /vendor/init.rc (depending on the firmware).

write /proc/sys/kernel/printk 4 4 1 7


write /sys/kernel/debug/tracing/buffer_size_kb 1024

Change the values to the desired ones (for example, buffer_size_kb 4096 for 4 After saving, restart the device.

Backup your current logs | Check the free space in /system| Make sure you have root rights | Download the file editor (e.g. MT Manager) | Prepare a command to roll back changes-->

Method 3: Through Magisk modules

If you use Magisk, you can install modules like Logcat Buffer Resizer or Kernel Adiutor that allow you to flexibly adjust the size of the buffer through a GUI.

Example of settings in Kernel Adiutor:

  1. Open the Logger section.
  2. Find Logcat buffer size and Kernel log buffer size.
  3. Set the desired values and apply the changes.

Frequent errors when setting up a log buffer and how to avoid them

Many users experience problems after resizing the buffer, and here are the most common errors and ways to solve them:

  • ๐Ÿ”„ The device does not boot after changing init.rc, which means you have made a syntax error or specified an unacceptable size. TWRP and edit the file again or restore the backup.
  • ๐Ÿ“‰ Decreased performance โ€“ too much buffer takes up RAM, which leads to Out of Memory errors.Solution: Reduce buffer size or optimize background processes.
  • ๐Ÿ“œ Logs are not saved after rebooting - by default, logcat is stored in RAM. To save logs permanently, use the command: logcat -f /sdcard/download/log.txt -r1024 -n10 where -r1024 โ€” file size, -n10 โ€” number of rotated files.
  • ๐Ÿ›‘ ADB does not see the device - check if debugging is enabled USB, Try to reinstall Xiaomi drivers. ADB Interface.
What if the device freezes after changing the buffer?
If Xiaomi doesnโ€™t respond to the buttons, try: 1. Hold Power + Vol Up for 10-15 seconds for a forced reboot. 2. If it doesnโ€™t, boot to Fastboot (Power + Vol Down) and execute the command: fastboot reboot recovery 3. In TWRP, undo changes to init.rc or restore the backup.

โš ๏ธ Note: Some Xiaomi devices with Dynamic RAM Expansion โ€“ too large a journal buffer may conflict with the swap mechanism, leading to sudden reboots.

How to check the current size of the magazine buffer

Before you change your settings, it's helpful to know the current values, and you can do this in a number of ways:

Method 1: Through ADB

Connect the device to the PC and do:

adb shell


logcat -g

The conclusion would be something like this:

ring buffer is 256Kb (255Kb consumed), max entry is 5120b, max payload is 4068b

Here, 256Kb is the current buffer size.

Method 2: Through applications

Install one of the following apps from Google Play:

  • ๐Ÿ“ฑ Logcat Extreme โ€“ shows the size of the buffer and allows you to change it (root required).
  • ๐Ÿ” MatLog โ€“ a convenient log viewer with buffer information.
  • ๐Ÿ› ๏ธ Kernel Adiutor โ€“ for advanced users with root rights.

In MatLog, the buffer size is displayed in the top toolbar, and if the value is highlighted in red, the buffer is crowded.

When to increase the magazine buffer and when not

Increasing the size of the magazine buffer is not always justified.

  • ๐Ÿž Debugging apps โ€“ if youโ€™re a developer and need full logs to analyze crashes.
  • ๐Ÿ”ง Firmware modification - when working with custom cores or firmware (LineageOS, AOSP).
  • ๐Ÿ“ก Diagnostics of network problems โ€“ Logic RIL (radio modules take up a lot of space.
  • ๐Ÿ”„ Frequent system failures โ€“ if the device spontaneously restarts, increasing the buffer will help to save logs until the moment of failure.

When not to increase the buffer:

  • ๐Ÿ“ฑ On devices with 2-3 GB of RAM (for example, Redmi) 7A, POCO C3).
  • ๐ŸŽฎ If you use your phone only for games and social networks (logs are not critical).
  • ๐Ÿ”‹ With a noticeable decrease in battery life (a large buffer increases the load on the processor).

๐Ÿ’ก

Only increase the log buffer if you know exactly what it is for. For most users, standard values (256-512 KB) are enough.

FAQ: Frequent questions about Xiaomi magazine buffer

Can I turn off the magazine buffer completely?
Technically, yes, but it's highly discouraged. Without logs, you can't diagnose malfunctions, and some system processes may not work properly. If you need to save memory, you'd better reduce the buffer size to a minimum (64-128 KB).
Why did the device slow down after the buffer was increased?
Chances are you've allocated too much log memory, and the system doesn't have enough RAM for background tasks. Try reducing the buffer size or disabling unnecessary apps in autoboot. Also check free memory with the adb shell free -h command.
How to save logs after rebooting?
By default, logcat is stored in RAM. To keep logs on a permanent basis, use the command: logcat -f /sdcard/log.txt -r1024 -n5 This will create a log.txt file on a rotating memory card (maximum 5 files of 1 MB each).
Can I change the size of the buffer on the locked loader?
Without unlocking the bootloader and root rights, you can temporarily resize the buffer through ADB, but after the reboot it will reset.
What are the most important logs for diagnosis?
For most problems, the following logs are enough: logcat โ€“ application and system errors. dmesg โ€“ kernel logs (critical crashes); radio log โ€“ problems with a mobile network or Wi-Fi. To write all logs at once, use the command: adb bugreport It will create a full report in.zip format.