check_inefficient

Function Description

msLeaks exposes this API to enable custom rapid analysis of inefficient memory detection.

Function Prototype

check_inefficient(input_path: str, mem_size: int = 0, inefficient_type: List[str] = None, idle_threshold: int = 3000) # If no input is provided, the default value is used.

Parameter Description

All input parameters must be obtained according to list_analyzers and get_analyzer_config. For details, see Table 1.

Table 1 Parameter Description

Parameter

Input/Output

Description

input_path

Input

Path of the .csv or .db file for which offline inefficient memory identification is required.

mem_size

Input

Inefficient memory threshold (unit: Bytes). Memory blocks below this threshold will not output results.

inefficient_type

Input

Classifies inefficient memory types and determines evaluation policies. Only results for user-concerned inefficient memory are outputted. Currently, the following types are supported:

  • early_allocation
  • late_deallocation
  • temporary_idleness

idle_threshold

Input

Threshold of the temporary idle inefficient memory API, which can be set as required.

Return Value Description

After the API is executed, the analysis process is printed and displayed. The identification result is written to the original file.

Example

1
2
3
4
5
import msleaks
msleaks.check_inefficient(input_path="user/ineff.csv",mem_size=0,
			  inefficient_type=["early_allocation","late_deallocation","temporary_idleness"],idle_threshold=3000
			  )
# Use the actual path for input_path.