OwlCyberSecurity - MANAGER
Edit File: test_memleaks.cpython-312.pyc
� ȓ�g; � �f � d Z ddlZddlZddlZddlZddlZddlmZ ddlmZ ddlmZ ddlm Z ddlm Z ddlmZ dd lm Z dd lmZ ddlmZ ddlmZ dd lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z ddlm!Z! ejD jF Z# ejH � Z%dZ&d� Z' G d � d!e� Z( G d"� d#e(� Z)ejT jW e d$�%� G d&� d'e� � Z, G d(� d)e� Z-y)*a� Tests for detecting function memory leaks (typically the ones implemented in C). It does so by calling a function many times and checking whether process memory usage keeps increasing between calls or over time. Note that this may produce false positives (especially on Windows for some reason). PyPy appears to be completely unstable for this framework, probably because of how its JIT handles memory, so tests are skipped. � N)�LINUX)�MACOS)�OPENBSD)�POSIX)�SUNOS)�WINDOWS)�HAS_CPU_AFFINITY)�HAS_CPU_FREQ)�HAS_ENVIRON)� HAS_IONICE)�HAS_MEMORY_MAPS)�HAS_NET_IO_COUNTERS)�HAS_PROC_CPU_NUM)�HAS_PROC_IO_COUNTERS)� HAS_RLIMIT)�HAS_SENSORS_BATTERY)�HAS_SENSORS_FANS)�HAS_SENSORS_TEMPERATURES)�TestMemoryLeak)�create_sockets)� get_testfn)�process_namespace)�pytest)�skip_on_access_denied)�spawn_testproc)�system_namespace)� terminate� c � � d� } | S )zsDecorator for those Linux functions which are implemented in pure Python, and which we want to run faster. c �B � � t j � � � fd�� }|S )Nc �� �� t rI| j j } t | j _ �| g|��i |��|| j _ S �| g|��i |��S # || j _ w xY w�N)r � __class__�times� FEW_TIMES)�self�args�kwargs�before�funs ��K/opt/hc_python/lib64/python3.12/site-packages/psutil/tests/test_memleaks.py�wrapperz5fewtimes_if_linux.<locals>.decorator.<locals>.wrapper@ si �� �����-�-��2�+4�D�N�N�(��t�5�d�5�f�5�+1�D�N�N�(��4�1�$�1�&�1�1�� ,2�D�N�N�(�s � A �A0)� functools�wraps)r* r, s ` r+ � decoratorz$fewtimes_if_linux.<locals>.decorator? s% �� � ���� � 2� � 2� �� � )r/ s r+ �fewtimes_if_linuxr2 : s � � � �r0 c � � e Zd ZdZeZd� Z e� d� � Z e� d� � Z e� d� � Z e� d� � Zej j e d�� e� d � � � Zej j e d�� e� d � � � Z e� d� � Zd� Zd � Zej j e d�� d� � Zej j e d�� d� � Zej j e d�� e� d� � � Zej j ed�� d� � Z e� d� � Z e� ee�� d� � � Zej j e d�� d� � Z ej j e d�� e� d� � � Z! e� d� � Z" e� ee�� d� � � Z# e� d� � Z$ e� ej j e% d�� d� � � Z& e� d� � Z' e� d� � Z(ej j e d�� e� d � � � Z)d!� Z* e� d"� � Z+ej j e, d�� d#� � Z-ej j e, d�� d$� � Z. e� d%� � Z/ej j e0 d�� e� d&� � � Z1ej j e2 d'�� ej j e3 d�� d(� � � Z4ej j e2 d'�� ej j e3 d�� d)� � � Z5 e� ej j ed*�� d+� � � Z6ej j e7 d�� d,� � Z8ej j e d�� d-� � Z9y.)/�TestProcessObjectLeaksz$Test leaks of Process class methods.c �l � t d � }|j | |j |j z � y r"