The question which file is responsible for memory in Androidoften arises among users who are faced with a lack of random access memory (RAM) or full internal storage. In fact, there is no single filein the Android operating system that would completely control memory - a whole complex of system components, configuration files and the Linux kernel are responsible for its distribution. However, some key files and processes directly affect how the device manages resources.
Many people mistakenly believe that you can simply edit some text file in the root folder and instantly increase the amount of RAM or clear the cache. The reality is more complicated: Android uses dynamic memory allocationwhere both hardware limitations (chipset, firmware) and software mechanisms (kernel, services Google Playare responsible for the logic). In this article, we will look at exactly which files and processes are involved in memory management, whether they can be modified, and what risks this carries.
It is worth warning right away: most system files related to memory are located in protected sections (/system, /vendor, /proc). Changing them requires root access and can lead to device instability or complete loss of data. If your goal is simply to free up space or speed up your smartphone, start with safe methods: clearing the cache, deleting unnecessary applications, or using tools like Android Storage Manager.
1. Linux kernel files that manage memory
Android is built on top of the kernel Linux, which means it inherits its memory management mechanisms. The main parameters that affect the distribution of RAM and virtual memory are stored in the virtual file system /proc. These files are not physical - they are generated by the kernel in real time and reflect the current state of the system.
Key files in /procmemory-related:
- ๐
/proc/meminfoโcontains detailed information about the state of RAM: total volume (MemTotal), free memory (MemFree), cached data (Cached), etc. This file can be read without root access through the terminal or applications like CPU-Z. - โ๏ธ
/proc/sys/vm/*โ a directory with virtual memory parameters. For example, the fileswappinessdetermines how actively the system uses the paging file (swap), andvfs_cache_pressureaffects clearing the file system cache. - ๐
/proc/[pid]/statusโ for each process (where[pid]is its identifier) information is stored here about memory consumption (VmRSS,VmSize). Useful for analyzing which applications are "eating" RAM.
Example content /proc/meminfo (simplified):
MemTotal: 3864576 kBMemFree: 1234560 kB
Buffers: 123456 kB
Cached: 890123 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Important: files in /proc cannot be edited directly - they are updated by the kernel in real time. However, some settings (such as swappiness) can be temporarily changed through terminal commands if you are root.
2. Configuration files in / system: low-level memory settings
In section /system files are stored that determine how Android allocates memory between processes. These files are loaded at system startup and affect its behavior globally. Among them:
- ๐
/system/build.propโcontains system properties, including memory parameters. For example, the linedalvik.vm.heapsizelimites the maximum heap size for applications to Dalvik (an obsolete virtual machine, but still used in some firmware). - ๐ง
/system/etc/init.d/- scripts that run on boot. Some custom firmware adds commands here to optimize memory (for example, settingvm.swappinessor clearing the cache on a schedule). - ๐ฅ๏ธ
/system/etc/zygote/- configurations for Zygote, the process that controls the creation of new applications. Memory limit settings for background tasks can be stored here.
Example lines from build.propthat affect memory:
dalvik.vm.heapsize=256mdalvik.vm.heapstargetutilization=0.75
dalvik.vm.heapgrowthlimit=192m
โ ๏ธ Warning: Editing build.prop without understanding the consequences can lead to endless loading of the device ("bootloop"). Always make a backup copy before making changes!
3. Swap files and virtual memory
Android by default does not use a swap file (swap) on most devices, since flash memory (where it is stored /data) has a limited overwrite resource. However, some custom firmware (for example, LineageOS) or applications like SwapEnabler allow you to activate swap by creating a file in /data/swapfile or /cache/swap.
How it works:
- ๐ If swap is enabled, the system can โdumpโ part of the data from RAM to this file, freeing up memory for active tasks. However, this slows downsince reading/writing to flash memory is much slower than to RAM.
- โ ๏ธSwap increases memory wear (NAND flash), especially on budget devices. It is not recommended to use it constantly.
- ๐ ๏ธ To create a swap file manually, you need root access and the command:
dd if=/dev/zero of=/data/swapfile bs=1M count=512mkswap /data/swapfile
swapon /data/swapfile
Checking active swap:
free -htotal used free shared buffers cached
Mem: 3.7G 2.1G 1.6G 100M 50M 800M
Swap: 512M 0B 512M
If you are experimenting with swap, disable it before turning off the device with the command swapoff /data/swapfileto avoid damage file system.
4. Cache files and temporary data: where is the "garbage" stored?
When it comes to internal memory (not RAM), the key files that take up space are located in the following directories:
- ๐๏ธ
/data/data/- application data is stored here (settings, databases, cache). For example, the cache can occupy hundreds of megabytes in APK files of installed applications (in new versions of Android, some applications are transferred to the system cache, including OTA update files. It is cleared automatically when there is not enough space, but sometimes requires manual cleaning. data-i="113">and Google Chrome can occupy hundreds of megabytes in/data/data/com.android.chrome/cache/. - ๐
/data/app/โ APK files of installed applications (in new versions of Android, some applications are transferred to/data/app-private/). - ๐
/cache/- system cache, including OTA update files. Cleans automatically when there is not enough space, but sometimes requires manual cleaning. - ๐ธ
/data/media/0/DCIM/And/data/media/0/Downloads/โuser files (photos, videos, downloads). They are often โbloatedโ due to duplicates or unnecessary files.
To see which files are taking up space, use the command:
du -h -d 1 /data | sort -h
(root access required).
To clear the cache without root, standard tools are suitable:
- Go to
Settings โ Storage. - Click
Clear cache(not "Clear data" - this will delete the settings applications!). - For deep cleaning, use SD Maid or Files by Google.
Delete unnecessary applications in Settings โ Applications
Clear cache in Settings โ Storage โ Cached data
Transfer photos/videos to the cloud or SD card
Check the folder Downloads for unnecessary files
Use Files by Google to find duplicates -->
5. Low Memory Killer (LMK): who โkillsโ processes when there is not enough RAM?
Android has a mechanism Low Memory Killer (LMK)that automatically kills processes when there is too little free memory left. The file /sys/module/lowmemorykiller/parameters/minfreeis responsible for its operation. This file contains threshold values โโ(in kilobytes), upon reaching which the system begins to โkillโ background tasks.
Example content minfree:
18432,23040,27648,32256,36864,41472
Here, each number corresponds to the level of criticality of memory shortage. When free RAM remains below the first value (18432 KB โ 18 MB), LMK begins to close processes, starting with the least priority ones.
Is it possible to change these values? Theoretically, yes, but:
- โ ๏ธ Too aggressive settings (
minfreewith low values) will lead to interface freezesas the system will respond too late to a lack of memory. - ๐ง Optimal values depend on RAM volume your device. For example, for 4 GB RAM, standard thresholds may look like
30720,38400,46080,53760,61440,69120. - ๐ Changes are reset after a reboot. To make them permanent, you need to edit the init scripts in
/system/etc/init.d/.
What happens if you disable LMK?
Without LMK, the system will not be able to automatically release RAM, which will lead to critical freezes when the memory is completely exhausted. In some custom firmware (for example, MIUI) LMK is set too aggressively, causing background applications to close too quickly. In such cases, it makes sense to slightly increase the thresholds in minfree, but not disable the mechanism completely.
6. Files responsible for caching applications (ART/Dalvik)
Android uses two types of cache to speed up the launch of applications:
- Dalvik-cache (obsolete) - cache for the virtual machine Dalvik, stored in
/data/dalvik-cache/. In modern versions of Android (8.0+) it is replaced by ART. - ART (Android Runtime) - the current application execution system. Its cache is located in
/data/art/(or/data/misc/apexdata/com.android.art/in new versions). Compiled versions of applications (files) are stored here, which speeds up their launch..oat,.odexfiles), which speeds up their launch.
These files can take up space, especially if many applications are installed. It is not recommended to clear them manually - the system rebuilds the cache automatically if necessary. However, if you notice that the folder several gigabytes, especially if you have many applications installed. It is not recommended to clear them manually - the system rebuilds the cache automatically if necessary. However, if you notice that the folder /data/art/ has grown to an inadequate size (for example, 5+ GB on a device with 16 GB of memory), this may indicate:
- ๐ Bug in the firmware (for example, in some versions MIUI 12 ART cache is not cleared correctly).
- ๐ Frequent reinstallation of applications (each installation/update creates new files in the cache).
- ๐ฆ Using modified APKs (for example, through Lucky Patcher), which may interfere with the operation of ART.
To safely clear the ART cache:
- Go to
Settings โ Applications โ All applications. - Find Google Play Services and Services Framework, clear their cache.
- Reboot the device - the system will rebuild the ART cache automatically.
โ ๏ธ Attention: Manually deleting files from /data/art/ without a reboot can lead to application crash at the next start. Always reboot the device after such manipulations!
7. How to check which files are taking up memory?
If you want to independently analyze what exactly is taking up space in memory, use the following methods:
Without root access:
- ๐ Applications: Files by Google, SD Maid (free version), DiskUsage โshow a graphical distribution of memory by folders.
- ๐ Built-in tools:
Settings โ Storage โ Other(shows large files).
C root access:
- ๐ฅ๏ธ Terminal: commands
df -h(shows the use of partitions) anddu -sh *(size of folders in the current directory). - ๐ Root Explorer or FX File Explorer โ allow you to view system folders (
/data,/system) and sort files by size.
Example analysis via adb shell:
adb shellsu
cd /data
du -h -d 1 | sort -h
This command will display a list of folders in /data, sorted by size (smallest to largest).
| Tool | Requires root? | What it shows | Example output |
|---|---|---|---|
| Files by Google | No | Large files and folders in user storage | "DCIM folder occupies 2.3 GB (1245 files)" |
df -h |
No | Use of system partitions | /data: 32G total, 24G used, 8G free |
| SD Maid | For deep scanning - yes | Cache, duplicates, residual files | "Unnecessary files: 1.2 GB (542 items)" |
du -sh /data/app |
Yes | Size of the folder with installed applications | 3.4G /data/app |
| DiskUsage | No | Graphic map of memory usage | Chart with color-coded folders |
If you are not sure which file can be deleted, donโt risk it! Deleting system files without understanding their purpose can lead to device inoperability. Start by clearing the cache and user data.
FAQ: Frequently asked questions about memory files in Android
Is it possible to increase RAM on Android by editing system files?
No, the physical amount of RAM is determined by the hardware (memory chip on the motherboard). However, you can:
- ๐ Use a swap file (swap), but this will slow down the work and increase memory wear.
- ๐ฑ Close unnecessary background processes (via
Settings โ Developer โ Not keep active). - ๐ง Optimize settings
lowmemorykiller(requires root).
Any software "increases" of RAM are a scam (for example, applications like RAM Expander create swap, but do not add physical memory).
Why does the memory fill up again after clearing the cache?
Caches are temporary files that are created to speed up the operation of applications. After cleaning, they are restored as the device is used. This is normal if:
- ๐ฑ The cache takes up no more than 1-2 GB (depending on the amount of memory of the device).
- ๐ After cleaning, the free space does not decrease catastrophically quickly (for example, from 10 GB to 0 per day).
If the cache grows to inadequate sizes (for example, 5+ GB), check:
- ๐ ๏ธ Application updates (sometimes bugs in new versions lead to leaks memory).
- ๐ฆ Applications that actively cache data (for example, Facebook, Instagram, Google Maps).
What is zygote and why does it take up so much memory?
Zygote is a system process that is responsible for launching new applications. It preloads frequently used libraries and resources to speed up opening apps. In tasks it may appear as com.android.zygote or zygote64 (for 64-bit applications).
Normal memory consumption for zygote:
- ๐ฑ 100โ300 MB on devices with 2โ4 GB RAM.
- ๐ฑ 300โ500 MB on flagships with 6+ GB RAM.
If zygote consumes more than 1 GB, this may indicate:
- ๐ Memory leak in the firmware (especially in custom ROMs).
- ๐ Conflict with installed modules Magisk or Xposed.
Solution: reboot the device or check the logs via logcat (command adb logcat | grep zygote).
Is it possible to transfer part of the internal memory to an SD card?
Yes, but with reservations:
- Android 6.0+: Support Adoptable Storage allows you to format the SD card as internal memory. However:
- ๐ฑ The card must be fast (UHS-I class or higher), otherwise the system will be slow.
- ๐ After formatting, the card cannot be used on other devices without losing data.
- โ ๏ธ Some applications (for example, WhatsApp) are not transferred to SD.
Settings โ Applications โ Transfer to SD.Important: SD cards have a limited rewriting resource Constant use of them as internal memory shortens the life. services.
How to recover deleted files from internal memory?
If you accidentally deleted important files (photos, documents) from internal memory, the chances of recovery depend on:
- ๐ Time: The less time has passed since the deletion, the higher the chances. New data can overwrite deleted files.
- ๐ฑ File types: Photos and videos are restored more easily than database files (for example, messages WhatsApp).
- ๐ง Availability of root: Without root, only files from user folders can be recovered (
/sdcard/).
Recovery tools:
- ๐ฑ DiskDigger (works without root, but with limitations).
- ๐ฅ๏ธ Recuva or PhotoRec (requires connecting memory to the PC via
ADBor card reader). - ๐ง Undeleter (need root to scan
/data).
Important: Do not install recovery apps on the same device from which you deleted the files - this reduces the chances of success!