function::module_size - Linux


Overview

The module_size command displays the size of a specific kernel module. It is useful for debugging module memory usage, finding memory leaks, and optimizing module code.

Syntax

module_size [module name]

Parameters:

  • module name: The name of the kernel module to query. Omit this parameter to query all loaded modules.

Options/Flags

| Option | Description | Default |
|—|—|—|
| -h, –help | Show this help text and exit | N/A |

Examples

Display the size of all loaded modules:

module_size

Display the size of a specific module:

module_size my_module

Get the size of multiple modules:

module_size module1 module2 module3

Common Issues

  • Module not found: Ensure that the specified module is loaded into the kernel. Use lsmod to list all loaded modules.

Integration

module_size can be used in conjunction with other Linux commands:

  • dmesg | grep module_size to check module sizes during system boot.
  • watch -n 1 module_size my_module to monitor module size changes over time.

Related Commands

  • lsmod: List loaded kernel modules.
  • modinfo: Display information about a specific module.
  • insmod: Insert a module into the kernel.
  • rmmod: Remove a module from the kernel.