Oracle Linux 7: Processes Consuming too much buf/cache memory

Abstract: Resolve high buf/cache memory consumption on Oracle Linux 7 by dropping caches via sysctl or adjusting swappiness to reclaim kernel-held RAM.

Created: 2026-09-01 by
High buf/cache memory consumption on Oracle Linux 7 is typically caused by the kernel caching file system data and directory entries rather than active application processes. To resolve this issue, you can manually trigger a cache drop using specific sysctl parameters or adjust the swappiness value to encourage the kernel to reclaim memory more aggressively during high-load scenarios.

Understanding buf/cache Memory Usage

In Linux systems, memory management is handled dynamically by the kernel. The term buf/cache refers to two distinct but related areas of kernel memory: buffers and caches. Buffers are used for raw block device I/O, while caches store metadata about files and directories. When you observe that free command output shows low available memory despite low process usage, it is often because the kernel has filled these structures with recently accessed file data to speed up future reads. This behavior is intentional and designed to optimize performance, but it can lead to out-of-memory errors if the system is under heavy disk I/O pressure or if the total RAM is insufficient for the workload. The confusion often arises because tools like top or htop may not attribute this memory to any specific user-space process. Instead, it appears as a global kernel reserve. It is crucial to distinguish this from application memory leaks or GPU memory issues, which require different diagnostic approaches as detailed in our guide on Process Memory Usage on Different Operating Systems. Unlike GPU memory, which is isolated to graphics drivers, buf/cache is shared across all file system operations.

Diagnosing the Source

Before attempting to free memory, verify that no runaway processes are actually consuming RAM. Use the ps aux --sort=-%mem | head -n 10 command to list the top ten memory-consuming processes. If these processes show reasonable memory footprints, the bulk of the "used" memory is indeed likely in the kernel cache. You can also check the status of dirty pages, which are cached blocks waiting to be written to disk, using vmstat 1 5. High values in the bi (blocks in) or bo (blocks out) columns indicate intense I/O activity that keeps the cache populated.

Manually Dropping the Cache

If the system is stable but memory is critically low, you can instruct the kernel to drop the page cache, dentries, and inodes. This action forces the kernel to discard cached data, freeing up RAM immediately. However, note that subsequent file access will incur disk I/O latency until the cache is rebuilt. To perform this operation safely, follow these steps:
  1. Synchronize pending writes: Run the sync command to ensure all dirty data is flushed to disk. This prevents data loss when the cache is dropped.
  2. Drop the caches: Execute the following command as root:
    echo 3 > /proc/sys/vm/drop_caches
    The value 3 tells the kernel to drop both page cache and dentries/inodes. Using 1 drops only page cache, while 2 drops only dentries and inodes.
  3. Verify memory recovery: Run free -h again to confirm that the available memory has increased.
This method provides immediate relief but does not prevent the cache from filling up again. For persistent issues, consider adjusting kernel parameters.

Adjusting Kernel Parameters for Stability

Modifying kernel settings can change how aggressively the system reclaims memory. Two primary parameters influence this behavior: vfs_cache_pressure and swappiness.

Tuning VFS Cache Pressure

The vfs_cache_pressure parameter controls the tendency of the kernel to reclaim memory used for caching directory and inode objects. The default value is usually 100. Increasing this value makes the kernel more aggressive in reclaiming these objects. For example, setting it to 200 doubles the rate at which these caches are shrunk relative to page cache. To apply this temporarily:
sysctl -w vm.vfs_cache_pressure=200
To make it permanent, add vm.vfs_cache_pressure=200 to /etc/sysctl.conf and run sysctl -p. Be cautious not to set this too high, as excessive reclamation can degrade performance due to frequent lookups.

Configuring Swappiness

Swappiness defines how much the kernel prefers to swap out runtime memory to disk versus dropping page cache. A lower value encourages the kernel to keep data in RAM. On systems with ample RAM, setting swappiness to 10 or 0 can help retain cached data longer, though this might increase the risk of OOM if actual application memory spikes occur. Refer to our article on Debugging Sudden Memory Usage Spike on Rocky Linux 8.9 for broader context on memory spike diagnostics across RHEL-based distributions.

Monitoring and Prevention

Regular monitoring helps identify patterns leading to high cache usage. Tools like iostat and iotop can reveal if specific applications are causing excessive I/O. If certain services consistently generate large temporary files or log outputs, consider configuring them to use tmpfs (RAM-backed file systems) for transient data, which automatically clears upon reboot and avoids polluting the main buffer cache. Additionally, ensure your kernel is updated, as newer versions of Oracle Linux 7 may include optimizations for memory management that address known inefficiencies.

Frequently Asked Questions

Is dropping the cache dangerous for running services?

Dropping the cache is generally safe but causes a temporary spike in disk I/O as services re-read necessary data. Ensure you have synced data first to prevent corruption of unwritten logs or transactions.

Why does buf/cache memory come back after being freed?

The kernel repopulates the cache as soon as files are accessed again. This is normal behavior designed to improve read speeds. If it fills up too quickly, investigate which processes are performing heavy sequential reads.

Can I disable buf/cache caching entirely?

No, you cannot disable caching entirely without severely degrading system performance. The kernel relies on it for efficient I/O operations. You can only tune its aggressiveness via sysctl parameters.

How do I check what is using the cache specifically?

You can use slabtop to view detailed breakdowns of kernel slab caches, including dentry and inode usage. This helps identify if specific subsystems are holding onto memory excessively.

Does increasing RAM solve high buf/cache usage?

Adding RAM allows the cache to grow larger before triggering reclamation, effectively pushing the problem further away. It does not fix the underlying cause of high I/O or inefficient caching strategies.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More