# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # # Translators: # Alireza Shabani (Revisto) , 2025 # Danial Behzadi , 2025 # Rafael Fontenelle , 2025 # Sepehr Rasouli , 2026 # msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-09-16 12:56+0000\n" "PO-Revision-Date: 2026-09-14 16:27+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/python/python-docs-fa/)\n" "Language: fa\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: Poedit 3.6\n" msgid "Memory Management" msgstr "مدیریت حافظه" msgid "Overview" msgstr "مرور کلی" msgid "Memory management in Python involves a private heap containing all Python objects and data structures. The management of this private heap is ensured internally by the *Python memory manager*. The Python memory manager has different components which deal with various dynamic storage management aspects, like sharing, segmentation, preallocation or caching." msgstr "مدیریت حافظه در پایتون شامل یک هیپ خصوصی است که تمام اشیاء و ساختارهای داده‌ی پایتون را در بر می‌گیرد. مدیریت این هیپ خصوصی به‌طور داخلی توسط *مدیر حافظه پایتون* تضمین می‌شود. مدیر حافظه پایتون اجزای مختلفی دارد که با جنبه‌های گوناگون مدیریت ذخیره‌سازی پویا، مانند اشتراک‌گذاری، قطعه‌بندی، پیش‌تخصیص یا نهان‌گذاری، سروکار دارند." msgid "At the lowest level, a raw memory allocator ensures that there is enough room in the private heap for storing all Python-related data by interacting with the memory manager of the operating system. On top of the raw memory allocator, several object-specific allocators operate on the same heap and implement distinct memory management policies adapted to the peculiarities of every object type. For example, integer objects are managed differently within the heap than strings, tuples or dictionaries because integers imply different storage requirements and speed/space tradeoffs. The Python memory manager thus delegates some of the work to the object-specific allocators, but ensures that the latter operate within the bounds of the private heap." msgstr "در پایین‌ترین سطح، یک تخصیص‌دهنده‌ی حافظه‌ی خام از طریق تعامل با مدیر حافظه‌ی سیستم‌عامل اطمینان می‌دهد که فضای کافی برای ذخیره‌سازی تمام داده‌های مرتبط با پایتون در هیپ خصوصی وجود داشته باشد. بر فراز تخصیص‌دهنده‌ی حافظه‌ی خام، چندین تخصیص‌دهنده‌ی مخصوص شیء روی همان هیپ فعالیت می‌کنند و سیاست‌های متمایز مدیریت حافظه را که با ویژگی‌های خاص هر نوع شیء تطبیق یافته‌اند، پیاده‌سازی می‌کنند. برای مثال، شیءهای عدد صحیح درون هیپ به‌گونه‌ای متفاوت از رشته‌ها، تاپل‌ها یا دیکشنری‌ها مدیریت می‌شوند، زیرا اعداد صحیح نیازمندی‌های ذخیره‌سازی و توازن‌های سرعت/فضای متفاوتی ایجاب می‌کنند. بدین ترتیب، مدیر حافظه‌ی پایتون بخشی از کار را به تخصیص‌دهنده‌های مخصوص شیء واگذار می‌کند، اما اطمینان می‌دهد که این تخصیص‌دهنده‌ها در محدوده‌ی هیپ خصوصی فعالیت کنند." msgid "It is important to understand that the management of the Python heap is performed by the interpreter itself and that the user has no control over it, even if they regularly manipulate object pointers to memory blocks inside that heap. The allocation of heap space for Python objects and other internal buffers is performed on demand by the Python memory manager through the Python/C API functions listed in this document." msgstr "مهم است بدانید که مدیریت هیپ پایتون توسط خودِ مفسر انجام می‌شود و کاربر هیچ کنترلی بر آن ندارد، حتی اگر به‌طور منظم اشاره‌گرهای اشیاء به بلوک‌های حافظه درون آن هیپ را دستکاری کند. تخصیص فضای هیپ برای اشیاء پایتون و بافرهای داخلی دیگر، به‌صورت درخواستی توسط مدیر حافظه پایتون از طریق توابع Python/C API فهرست‌شده در این سند انجام می‌شود." msgid "To avoid memory corruption, extension writers should never try to operate on Python objects with the functions exported by the C library: :c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` and :c:func:`free`. This will result in mixed calls between the C allocator and the Python memory manager with fatal consequences, because they implement different algorithms and operate on different heaps. However, one may safely allocate and release memory blocks with the C library allocator for individual purposes, as shown in the following example::" msgstr "برای پرهیز از خرابی حافظه، نویسندگان ماژول‌های توسعه‌ای هرگز نباید سعی کنند با توابع اکسپورتشده توسط کتابخانه C: :c:func:`malloc`، :c:func:`calloc`، :c:func:`realloc` و :c:func:`free` روی اشیاء پایتون عمل کنند. این کار به فراخوانی‌های ترکیبی میان تخصیص‌دهنده C و مدیر حافظه پایتون با پیامدهای مرگبار منجر خواهد شد، زیرا آن‌ها الگوریتم‌های متفاوتی را پیاده‌سازی می‌کنند و روی هیپ‌های متفاوتی کار می‌کنند. با این حال، می‌توان برای مقاصد شخصی، بلوک‌های حافظه را با تخصیص‌دهنده کتابخانه C به‌طور ایمن تخصیص داد و آزاد کرد، همان‌طور که در مثال زیر نشان داده شده است::" msgid "" "PyObject *res;\n" "char *buf = (char *) malloc(BUFSIZ); /* for I/O */\n" "\n" "if (buf == NULL)\n" " return PyErr_NoMemory();\n" "...Do some I/O operation involving buf...\n" "res = PyBytes_FromString(buf);\n" "free(buf); /* malloc'ed */\n" "return res;" msgstr "" "PyObject *res;\n" "char *buf = (char *) malloc(BUFSIZ); /* برای ورودی/خروجی */\n" "\n" "if (buf == NULL)\n" " return PyErr_NoMemory();\n" "...انجام برخی عملیات ورودی/خروجی با buf...\n" "res = PyBytes_FromString(buf);\n" "free(buf); /* تخصیص‌یافته با malloc */\n" "return res;" msgid "In this example, the memory request for the I/O buffer is handled by the C library allocator. The Python memory manager is involved only in the allocation of the bytes object returned as a result." msgstr "در این مثال، درخواست حافظه برای بافر ورودی/خروجی توسط تخصیص‌دهنده‌ی کتابخانه C برطرف می‌شود. مدیر حافظه‌ی پایتون تنها در تخصیص شیء بایتی که به‌عنوان نتیجه بازگردانده می‌شود نقش دارد." msgid "In most situations, however, it is recommended to allocate memory from the Python heap specifically because the latter is under control of the Python memory manager. For example, this is required when the interpreter is extended with new object types written in C. Another reason for using the Python heap is the desire to *inform* the Python memory manager about the memory needs of the extension module. Even when the requested memory is used exclusively for internal, highly specific purposes, delegating all memory requests to the Python memory manager causes the interpreter to have a more accurate image of its memory footprint as a whole. Consequently, under certain circumstances, the Python memory manager may or may not trigger appropriate actions, like garbage collection, memory compaction or other preventive procedures. Note that by using the C library allocator as shown in the previous example, the allocated memory for the I/O buffer completely escapes the Python memory manager." msgstr "با این حال، در بیشتر موارد توصیه می‌شود حافظه از هیپ پایتون تخصیص داده شود، دقیقاً به این دلیل که دومی تحت کنترل مدیر حافظه پایتون است. برای مثال، این کار زمانی لازم است که مفسر با نوع‌های جدید شیء نوشته‌شده به زبان C توسعه یابد. دلیل دیگر استفاده از هیپ پایتون، تمایل به *آگاه‌سازی* مدیر حافظه پایتون از نیازهای حافظه‌ای ماژول توسعه‌ای است. حتی وقتی حافظه درخواست‌شده صرفاً برای مقاصد داخلی و بسیار خاص استفاده می‌شود، واگذاری تمام درخواست‌های حافظه به مدیر حافظه پایتون باعث می‌شود مفسر تصویری دقیق‌تر از ردپای کلی حافظه خود داشته باشد. در نتیجه، در شرایط خاص، مدیر حافظه پایتون ممکن است کنش‌های مناسب مانند زباله‌روبی، فشرده‌سازی حافظه یا سایر رویه‌های پیشگیرانه را فعال کند یا نکند. توجه داشته باشید که با استفاده از تخصیص‌دهنده کتابخانه C، همان‌طور که در مثال قبلی نشان داده شد، حافظه تخصیص‌یافته برای بافر ورودی/خروجی کاملاً از دسترس مدیر حافظه پایتون خارج می‌شود." msgid "The :envvar:`PYTHONMALLOC` environment variable can be used to configure the memory allocators used by Python." msgstr "متغیر محیطی :envvar:`PYTHONMALLOC` می‌تواند برای پیکربندی تخصیص‌دهنده‌های حافظه‌ای که پایتون به کار می‌گیرد، استفاده شود." msgid "The :envvar:`PYTHONMALLOCSTATS` environment variable can be used to print statistics of the :ref:`pymalloc memory allocator ` every time a new pymalloc object arena is created, and on shutdown." msgstr "متغیر محیطی :envvar:`PYTHONMALLOCSTATS` می‌تواند هر بار که یک آرنا (arena) جدید برای اشیاء pymalloc ایجاد می‌شود و هنگام خاموش شدن، آمار :ref:`تخصیص‌دهنده حافظه pymalloc ` را چاپ کند." msgid "Allocator Domains" msgstr "دامنه‌های تخصیص‌دهنده" msgid "All allocating functions belong to one of three different \"domains\" (see also :c:type:`PyMemAllocatorDomain`). These domains represent different allocation strategies and are optimized for different purposes. The specific details on how every domain allocates memory or what internal functions each domain calls is considered an implementation detail, but for debugging purposes a simplified table can be found at :ref:`default-memory-allocators`. The APIs used to allocate and free a block of memory must be from the same domain. For example, :c:func:`PyMem_Free` must be used to free memory allocated using :c:func:`PyMem_Malloc`." msgstr "تمام توابع تخصیص‌دهنده به یکی از سه «قلمرو» (domain) متفاوت تعلق دارند (همچنین :c:type:`PyMemAllocatorDomain` را ببینید). این قلمروها نماینده‌ی راهبردهای تخصیص متفاوت هستند و برای اهداف مختلف بهینه شده‌اند. جزئیات دقیق اینکه هر قلمرو چگونه حافظه را تخصیص می‌دهد یا هر قلمرو چه توابع داخلی را فراخوانی می‌کند، از جزئیات پیاده‌سازی به شمار می‌آید، اما برای اهداف اشکال‌زدایی می‌توان یک جدول ساده‌شده را در :ref:`default-memory-allocators` یافت. APIهایی که برای تخصیص و آزاد کردن یک بلوک حافظه استفاده می‌شوند، باید از یک قلمرو واحد باشند. به‌عنوان مثال، برای آزاد کردن حافظه‌ای که با :c:func:`PyMem_Malloc` تخصیص داده شده است، باید از :c:func:`PyMem_Free` استفاده کرد." msgid "The three allocation domains are:" msgstr "سه دامنه‌ی تخصیص عبارت‌اند از:" msgid "Raw domain: intended for allocating memory for general-purpose memory buffers where the allocation *must* go to the system allocator or where the allocator can operate without an :term:`attached thread state`. The memory is requested directly from the system. See :ref:`Raw Memory Interface `." msgstr "دامنه خام: برای تخصیص حافظه به بافرهای حافظه‌ی همه‌منظوره در مواردی در نظر گرفته شده است که تخصیص *باید* به تخصیص‌دهنده‌ی سیستم برود یا تخصیص‌دهنده بتواند بدون :term:`attached thread state` کار کند. حافظه مستقیماً از سیستم درخواست می‌شود. به :ref:`رابط حافظه خام ` مراجعه کنید." msgid "\"Mem\" domain: intended for allocating memory for Python buffers and general-purpose memory buffers where the allocation must be performed with an :term:`attached thread state`. The memory is taken from the Python private heap. See :ref:`Memory Interface `." msgstr "دامنه‌ی \"Mem\": برای تخصیص حافظه به بافرهای پایتون و بافرهای حافظه‌ی همه‌منظوره در مواردی که تخصیص باید با :term:`attached thread state` انجام شود، در نظر گرفته شده است. حافظه از هیپ خصوصی پایتون گرفته می‌شود. به :ref:`رابط حافظه ` مراجعه کنید." msgid "Object domain: intended for allocating memory for Python objects. The memory is taken from the Python private heap. See :ref:`Object allocators `." msgstr "دامنه‌ی شیء: برای تخصیص حافظه به اشیای پایتون در نظر گرفته شده است. این حافظه از هیپ خصوصی پایتون گرفته می‌شود. به :ref:`تخصیص‌دهنده‌های شیء ` مراجعه کنید." msgid "The :term:`free-threaded ` build requires that only Python objects are allocated using the \"object\" domain and that all Python objects are allocated using that domain. This differs from the prior Python versions, where this was only a best practice and not a hard requirement." msgstr "ساخت‌ :term:`نخ‌آزاد ` ایجاب می‌کند که تنها اشیاء پایتون با استفاده از دامنه‌ی \"object\" تخصیص داده شوند و اینکه همه‌ی اشیاء پایتون با استفاده از آن دامنه تخصیص داده شوند. این با نسخه‌های پیشین پایتون متفاوت است، که در آن‌ها این امر تنها یک بهترین شیوه بود و نه یک الزام قطعی." msgid "For example, buffers (non-Python objects) should be allocated using :c:func:`PyMem_Malloc`, :c:func:`PyMem_RawMalloc`, or :c:func:`malloc`, but not :c:func:`PyObject_Malloc`." msgstr "برای مثال، بافرها (اشیاء غیرپایتونی) باید با استفاده از :c:func:`PyMem_Malloc`، :c:func:`PyMem_RawMalloc` یا :c:func:`malloc` تخصیص داده شوند، اما نه با :c:func:`PyObject_Malloc`." msgid "See :ref:`Memory Allocation APIs `." msgstr "به :ref:`API‌های تخصیص حافظه ` مراجعه کنید." msgid "Raw Memory Interface" msgstr "رابط حافظه خام" msgid "The following function sets are wrappers to the system allocator. These functions are thread-safe, so a :term:`thread state` does not need to be :term:`attached `." msgstr "مجموعه‌های تابع زیر دربرگیرنده‌ی تخصیص‌دهنده‌ی سیستم هستند. این توابع نخ‌ایمن هستند، بنابراین :term:`وضعیت نخ ` نیازی ندارد که :term:`متصل ` باشد." msgid "The :ref:`default raw memory allocator ` uses the following functions: :c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` and :c:func:`!free`; call ``malloc(1)`` (or ``calloc(1, 1)``) when requesting zero bytes." msgstr ":ref:`تخصیص‌دهنده‌ی حافظه‌ی خام پیش‌فرض ` از توابع زیر استفاده می‌کند: :c:func:`malloc`، :c:func:`calloc`، :c:func:`realloc` و :c:func:`!free`؛ هنگام درخواست صفر بایت، ``malloc(1)`` (یا ``calloc(1, 1)``) فراخوانی می‌شود." msgid "Allocates *n* bytes and returns a pointer of type :c:expr:`void*` to the allocated memory, or ``NULL`` if the request fails." msgstr "*n* بایت تخصیص می‌دهد و اشاره‌گری از نوع :c:expr:`void*` به حافظه‌ی تخصیص‌یافته برمی‌گرداند، یا اگر درخواست شکست بخورد، ``NULL``." msgid "Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, as if ``PyMem_RawMalloc(1)`` had been called instead. The memory will not have been initialized in any way." msgstr "درخواست صفر بایت در صورت امکان یک اشاره‌گر متمایز غیر ``NULL`` برمی‌گرداند، گویی به جای آن ``PyMem_RawMalloc(1)`` فراخوانی شده است. حافظه به هیچ شکلی مقداردهی اولیه نخواهد شد." msgid "Allocates *nelem* elements each of size *elsize* bytes and returns a pointer of type :c:expr:`void*` to the allocated memory, or ``NULL`` if the request fails. The memory is initialized to zeros." msgstr "*nelem* عنصر که هر یک به اندازه‌ی *elsize* بایت است تخصیص می‌دهد و اشاره‌گری از نوع :c:expr:`void*` به حافظه‌ی تخصیص‌یافته برمی‌گرداند، یا در صورتی که درخواست شکست بخورد، ``NULL`` برمی‌گرداند. حافظه با صفر مقداردهی اولیه می‌شود." msgid "Requesting zero elements or elements of size zero bytes returns a distinct non-``NULL`` pointer if possible, as if ``PyMem_RawCalloc(1, 1)`` had been called instead." msgstr "درخواست صفر المان یا المان‌هایی با اندازه‌ی صفر بایت، در صورت امکان یک اشاره‌گر متمایز غیر ``NULL`` برمی‌گرداند؛ گویی به جای آن ``PyMem_RawCalloc(1, 1)`` فراخوانی شده است." msgid "Resizes the memory block pointed to by *p* to *n* bytes. The contents will be unchanged to the minimum of the old and the new sizes." msgstr "اندازه بلوک حافظه‌ای را که *p* به آن اشاره می‌کند به *n* بایت تغییر می‌دهد. محتویات تا کمینه‌ی اندازه‌های قدیمی و جدید بدون تغییر باقی می‌مانند." msgid "If *p* is ``NULL``, the call is equivalent to ``PyMem_RawMalloc(n)``; else if *n* is equal to zero, the memory block is resized but is not freed, and the returned pointer is non-``NULL``." msgstr "اگر *p* برابر ``NULL`` باشد، این فراخوانی معادل ``PyMem_RawMalloc(n)`` است؛ در غیر این صورت، اگر *n* برابر صفر باشد، بلوک حافظه تغییر اندازه می‌یابد اما آزاد نمی‌شود، و اشاره‌گر برگردانده‌شده غیر ``NULL`` است." msgid "Unless *p* is ``NULL``, it must have been returned by a previous call to :c:func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc` or :c:func:`PyMem_RawCalloc`." msgstr "مگر آنکه *p* برابر ``NULL`` باشد، باید توسط فراخوانی قبلیِ :c:func:`PyMem_RawMalloc`، :c:func:`PyMem_RawRealloc` یا :c:func:`PyMem_RawCalloc` بازگردانده شده باشد." msgid "If the request fails, :c:func:`PyMem_RawRealloc` returns ``NULL`` and *p* remains a valid pointer to the previous memory area." msgstr "اگر درخواست شکست بخورد، :c:func:`PyMem_RawRealloc` مقدار ``NULL`` را برمی‌گرداند و *p* همچنان اشاره‌گر معتبری به ناحیه حافظه قبلی باقی می‌ماند." msgid "Frees the memory block pointed to by *p*, which must have been returned by a previous call to :c:func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc` or :c:func:`PyMem_RawCalloc`. Otherwise, or if ``PyMem_RawFree(p)`` has been called before, undefined behavior occurs." msgstr "بلوک حافظه‌ای را که *p* به آن اشاره می‌کند آزاد می‌کند، که باید قبلاً توسط فراخوانی :c:func:`PyMem_RawMalloc`، :c:func:`PyMem_RawRealloc` یا :c:func:`PyMem_RawCalloc` بازگردانده شده باشد. در غیر این صورت، یا اگر ``PyMem_RawFree(p)`` قبلاً فراخوانی شده باشد، رفتار تعریف‌نشده رخ می‌دهد." msgid "If *p* is ``NULL``, no operation is performed." msgstr "اگر *p* برابر ``NULL`` باشد، هیچ عملیاتی انجام نمی‌شود." msgid "Memory Interface" msgstr "رابط حافظه" msgid "The following function sets, modeled after the ANSI C standard, but specifying behavior when requesting zero bytes, are available for allocating and releasing memory from the Python heap." msgstr "مجموعه‌های تابع زیر، که بر اساس استاندارد ANSI C الگوبرداری شده‌اند، اما رفتار هنگام درخواست صفر بایت را مشخص می‌کنند، برای تخصیص و آزادسازی حافظه از هیپ پایتون در دسترس هستند." msgid "In the GIL-enabled build (default build) the :ref:`default memory allocator ` uses the :ref:`pymalloc memory allocator `, whereas in the :term:`free-threaded build`, the default is the :ref:`mimalloc memory allocator ` instead." msgstr "در ساخت‌ دارای قفل مفسر سراسری (ساخت‌ پیش‌فرض)، :ref:`تخصیص‌دهنده‌ی حافظه‌ی پیش‌فرض ` از :ref:`تخصیص‌دهنده‌ی حافظه‌ی pymalloc ` استفاده می‌کند، در حالی که در :term:`free-threaded build`، پیش‌فرض :ref:`تخصیص‌دهنده‌ی حافظه‌ی mimalloc ` است." msgid "There must be an :term:`attached thread state` when using these functions." msgstr "هنگام استفاده از این توابع، باید یک :term:`وضعیت نخ متصل ` وجود داشته باشد." msgid "The default allocator is now pymalloc instead of system :c:func:`malloc`." msgstr "تخصیص‌دهنده پیش‌فرض اکنون pymalloc است، به‌جای :c:func:`malloc` سیستمی." msgid "In the :term:`free-threaded ` build, the default allocator is now :ref:`mimalloc `." msgstr "در ساخت‌ :term:`نخ‌آزاد `، تخصیص‌دهنده‌ی پیش‌فرض اکنون :ref:`mimalloc ` است." msgid "Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, as if ``PyMem_Malloc(1)`` had been called instead. The memory will not have been initialized in any way." msgstr "درخواست صفر بایت در صورت امکان یک اشاره‌گر متمایز و غیر ``NULL`` برمی‌گرداند، گویی که به‌جای آن ``PyMem_Malloc(1)`` فراخوانی شده است. این حافظه به هیچ شکلی مقداردهی اولیه نشده خواهد بود." msgid "Requesting zero elements or elements of size zero bytes returns a distinct non-``NULL`` pointer if possible, as if ``PyMem_Calloc(1, 1)`` had been called instead." msgstr "درخواست صفر المان یا المان‌هایی با اندازه‌ی صفر بایت، در صورت امکان یک اشاره‌گر متمایز غیر ``NULL`` برمی‌گرداند، گویی به‌جای آن ``PyMem_Calloc(1, 1)`` فراخوانی شده بود." msgid "If *p* is ``NULL``, the call is equivalent to ``PyMem_Malloc(n)``; else if *n* is equal to zero, the memory block is resized but is not freed, and the returned pointer is non-``NULL``." msgstr "اگر *p* برابر ``NULL`` باشد، این فراخوانی معادل ``PyMem_Malloc(n)`` است؛ در غیر این صورت، اگر *n* برابر صفر باشد، بلوک حافظه تغییر اندازه می‌یابد اما آزاد نمی‌شود و اشاره‌گر بازگردانده‌شده غیر ``NULL`` است." msgid "Unless *p* is ``NULL``, it must have been returned by a previous call to :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` or :c:func:`PyMem_Calloc`." msgstr "مگر اینکه *p* برابر ``NULL`` باشد، این مقدار باید توسط یک فراخوانی قبلی به :c:func:`PyMem_Malloc`، :c:func:`PyMem_Realloc` یا :c:func:`PyMem_Calloc` بازگردانده شده باشد." msgid "If the request fails, :c:func:`PyMem_Realloc` returns ``NULL`` and *p* remains a valid pointer to the previous memory area." msgstr "اگر درخواست ناموفق باشد، :c:func:`PyMem_Realloc` مقدار ``NULL`` را برمی‌گرداند و *p* همچنان اشاره‌گر معتبری به ناحیه‌ی حافظه قبلی باقی می‌ماند." msgid "Frees the memory block pointed to by *p*, which must have been returned by a previous call to :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` or :c:func:`PyMem_Calloc`. Otherwise, or if ``PyMem_Free(p)`` has been called before, undefined behavior occurs." msgstr "بلوک حافظه‌ای را که *p* به آن اشاره می‌کند آزاد می‌کند؛ این بلوک باید قبلاً توسط فراخوانی :c:func:`PyMem_Malloc`، :c:func:`PyMem_Realloc` یا :c:func:`PyMem_Calloc` بازگردانده شده باشد. در غیر این صورت، یا اگر ``PyMem_Free(p)`` پیش‌تر فراخوانی شده باشد، رفتار تعریف‌نشده رخ می‌دهد." msgid "The following type-oriented macros are provided for convenience. Note that *TYPE* refers to any C type." msgstr "ماکروهای نوع‌محور زیر برای سهولت فراهم شده‌اند. توجه داشته باشید که *TYPE* به هر نوع C اشاره می‌کند." msgid "Same as :c:func:`PyMem_Malloc`, but allocates ``(n * sizeof(TYPE))`` bytes of memory. Returns a pointer cast to ``TYPE*``. The memory will not have been initialized in any way." msgstr "مانند :c:func:`PyMem_Malloc` است، اما ``(n * sizeof(TYPE))`` بایت حافظه تخصیص می‌دهد. اشاره‌گری قالب‌ریزی‌شده به ``TYPE*`` برمی‌گرداند. حافظه به هیچ شکلی مقداردهی اولیه نشده است." msgid "Same as :c:func:`PyMem_Realloc`, but the memory block is resized to ``(n * sizeof(TYPE))`` bytes. Returns a pointer cast to ``TYPE*``. On return, *p* will be a pointer to the new memory area, or ``NULL`` in the event of failure." msgstr "مانند :c:func:`PyMem_Realloc` است، اما بلوک حافظه به ``(n * sizeof(TYPE))`` بایت تغییر اندازه می‌یابد. اشاره‌گری قالب‌ریزی‌شده به ``TYPE*`` را برمی‌گرداند. هنگام بازگشت، *p* اشاره‌گری به ناحیه حافظه جدید خواهد بود، یا در صورت شکست ``NULL``." msgid "This is a C preprocessor macro; *p* is always reassigned. Save the original value of *p* to avoid losing memory when handling errors." msgstr "این یک ماکروی پیش‌پردازنده C است؛ *p* همیشه دوباره انتساب می‌شود. مقدار اصلی *p* را ذخیره کنید تا هنگام مدیریت خطاها حافظه از دست نرود." msgid "Same as :c:func:`PyMem_Free`." msgstr "مانند :c:func:`PyMem_Free` است." msgid "Deprecated aliases" msgstr "نام‌های مستعار منسوخ" msgid "These are :term:`soft deprecated` aliases to existing functions and macros. They exist solely for backwards compatibility." msgstr "این‌ها نام‌های مستعار :term:`منسوخ نرم ` برای توابع و ماکروهای موجود هستند. این نام‌های مستعار صرفاً برای سازگاری با نسخه‌های پیشین وجود دارند." msgid "Deprecated alias" msgstr "نام مستعار منسوخ" msgid "Corresponding function or macro" msgstr "تابع یا ماکروی متناظر" msgid ":c:func:`PyMem_Malloc`" msgstr ":c:func:`PyMem_Malloc`" msgid ":c:macro:`PyMem_New`" msgstr ":c:macro:`PyMem_New`" msgid ":c:func:`PyMem_Realloc`" msgstr ":c:func:`PyMem_Realloc`" msgid ":c:macro:`PyMem_Resize`" msgstr ":c:macro:`PyMem_Resize`" msgid ":c:func:`PyMem_Free`" msgstr ":c:func:`PyMem_Free`" msgid "The macros are now aliases of the corresponding functions and macros. Previously, their behavior was the same, but their use did not necessarily preserve binary compatibility across Python versions." msgstr "این ماکروها اکنون نام‌مستعار توابع و ماکروهای متناظر هستند. پیش‌تر، رفتار آن‌ها یکسان بود، اما استفاده از آن‌ها لزوماً سازگاری دودویی را بین نسخه‌های پایتون حفظ نمی‌کرد." msgid "Object allocators" msgstr "تخصیص‌دهنده‌های شیء" msgid "There is no guarantee that the memory returned by these allocators can be successfully cast to a Python object when intercepting the allocating functions in this domain by the methods described in the :ref:`Customize Memory Allocators ` section." msgstr "هنگام رهگیری توابع تخصیص‌دهنده در این دامنه با استفاده از روش‌های توضیح داده‌شده در بخش :ref:`سفارشی‌سازی تخصیص‌دهنده‌های حافظه `، هیچ تضمینی وجود ندارد که حافظه‌ی بازگردانده‌شده توسط این تخصیص‌دهنده‌ها بتواند با موفقیت به یک شیء پایتون قالب‌ریزی شود." msgid "The :ref:`default object allocator ` uses the :ref:`pymalloc memory allocator `. In the :term:`free-threaded ` build, the default is the :ref:`mimalloc memory allocator ` instead." msgstr ":ref:`تخصیص‌دهنده پیش‌فرض اشیاء ` از :ref:`تخصیص‌دهنده حافظه pymalloc ` استفاده می‌کند. در ساخت :term:`نخ‌آزاد `، پیش‌فرض به‌جای آن :ref:`تخصیص‌دهنده حافظه mimalloc ` است." msgid "Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, as if ``PyObject_Malloc(1)`` had been called instead. The memory will not have been initialized in any way." msgstr "درخواست صفر بایت در صورت امکان یک اشاره‌گر متمایز غیر ``NULL`` بازمی‌گرداند، گویی که به جای آن ``PyObject_Malloc(1)`` فراخوانی شده است. حافظه به هیچ شکلی مقداردهی اولیه نخواهد شد." msgid "Requesting zero elements or elements of size zero bytes returns a distinct non-``NULL`` pointer if possible, as if ``PyObject_Calloc(1, 1)`` had been called instead." msgstr "درخواست صفر عنصر یا عناصری با اندازه‌ی صفر بایت، در صورت امکان، یک اشاره‌گر متمایز غیر ``NULL`` برمی‌گرداند، گویی که به جای آن ``PyObject_Calloc(1, 1)`` فراخوانی شده باشد." msgid "If *p* is ``NULL``, the call is equivalent to ``PyObject_Malloc(n)``; else if *n* is equal to zero, the memory block is resized but is not freed, and the returned pointer is non-``NULL``." msgstr "اگر *p* برابر ``NULL`` باشد، این فراخوانی معادل ``PyObject_Malloc(n)`` است؛ در غیر این صورت، اگر *n* برابر صفر باشد، بلوک حافظه تغییر اندازه می‌یابد اما آزاد نمی‌شود و اشاره‌گر بازگردانده‌شده غیر ``NULL`` است." msgid "Unless *p* is ``NULL``, it must have been returned by a previous call to :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc` or :c:func:`PyObject_Calloc`." msgstr "مگر اینکه *p* برابر ``NULL`` باشد، باید قبلاً توسط فراخوانی :c:func:`PyObject_Malloc`، :c:func:`PyObject_Realloc` یا :c:func:`PyObject_Calloc` برگردانده شده باشد." msgid "If the request fails, :c:func:`PyObject_Realloc` returns ``NULL`` and *p* remains a valid pointer to the previous memory area." msgstr "اگر درخواست شکست بخورد، :c:func:`PyObject_Realloc` مقدار ``NULL`` را برمی‌گرداند و *p* همچنان اشاره‌گر معتبری به ناحیه حافظه قبلی باقی می‌ماند." msgid "Frees the memory block pointed to by *p*, which must have been returned by a previous call to :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc` or :c:func:`PyObject_Calloc`. Otherwise, or if ``PyObject_Free(p)`` has been called before, undefined behavior occurs." msgstr "بلوک حافظه‌ای را که *p* به آن اشاره می‌کند آزاد می‌کند، که باید توسط یک فراخوانی قبلی به :c:func:`PyObject_Malloc`، :c:func:`PyObject_Realloc` یا :c:func:`PyObject_Calloc` برگردانده شده باشد. در غیر این صورت، یا اگر ``PyObject_Free(p)`` پیش‌تر فراخوانی شده باشد، رفتار تعریف‌نشده رخ می‌دهد." msgid "Do not call this directly to free an object's memory; call the type's :c:member:`~PyTypeObject.tp_free` slot instead." msgstr "برای آزاد کردن حافظه‌ی یک شیء، این را مستقیماً فراخوانی نکنید؛ در عوض جایگاه :c:member:`~PyTypeObject.tp_free` نوع را فراخوانی کنید." msgid "Do not use this for memory allocated by :c:macro:`PyObject_GC_New` or :c:macro:`PyObject_GC_NewVar`; use :c:func:`PyObject_GC_Del` instead." msgstr "از این برای حافظه‌ای که توسط :c:macro:`PyObject_GC_New` یا :c:macro:`PyObject_GC_NewVar` تخصیص‌یافته است استفاده نکنید؛ به جای آن از :c:func:`PyObject_GC_Del` استفاده کنید." msgid ":c:func:`PyObject_GC_Del` is the equivalent of this function for memory allocated by types that support garbage collection." msgstr ":c:func:`PyObject_GC_Del` معادل این تابع برای حافظه‌ی تخصیص‌یافته توسط نوع‌هایی است که از زباله‌روبی پشتیبانی می‌کنند." msgid ":c:func:`PyObject_Malloc`" msgstr ":c:func:`PyObject_Malloc`" msgid ":c:func:`PyObject_Realloc`" msgstr ":c:func:`PyObject_Realloc`" msgid ":c:func:`PyObject_Calloc`" msgstr ":c:func:`PyObject_Calloc`" msgid ":c:macro:`PyObject_New`" msgstr ":c:macro:`PyObject_New`" msgid ":c:macro:`PyObject_NewVar`" msgstr ":c:macro:`PyObject_NewVar`" msgid ":c:func:`PyType_GenericAlloc`" msgstr ":c:func:`PyType_GenericAlloc`" msgid ":c:member:`~PyTypeObject.tp_free`" msgstr ":c:member:`~PyTypeObject.tp_free`" msgid "Default Memory Allocators" msgstr "تخصیص‌دهنده‌های حافظه پیش‌فرض" msgid "Default memory allocators:" msgstr "تخصیص‌دهنده‌های پیش‌فرض حافظه:" msgid "Configuration" msgstr "پیکربندی" msgid "Name" msgstr "نام" msgid "PyMem_RawMalloc" msgstr "PyMem_RawMalloc" msgid "PyMem_Malloc" msgstr "PyMem_Malloc" msgid "PyObject_Malloc" msgstr "PyObject_Malloc" msgid "Release build" msgstr "ساخت‌ انتشار (Release build)" msgid "``\"pymalloc\"``" msgstr "``\"pymalloc\"``" msgid "``malloc``" msgstr "``malloc``" msgid "``pymalloc``" msgstr "``pymalloc``" msgid "Debug build" msgstr "ساخت اشکال‌زدایی" msgid "``\"pymalloc_debug\"``" msgstr "``\"pymalloc_debug\"``" msgid "``malloc`` + debug" msgstr "``malloc`` + اشکال‌زدایی" msgid "``pymalloc`` + debug" msgstr "``pymalloc`` + دیباگ" msgid "Release build, without pymalloc" msgstr "ساخت‌ انتشار، بدون pymalloc" msgid "``\"malloc\"``" msgstr "``\"malloc\"``" msgid "Debug build, without pymalloc" msgstr "ساخت دیباگ، بدون pymalloc" msgid "``\"malloc_debug\"``" msgstr "``\"malloc_debug\"``" msgid "Free-threaded build" msgstr "ساخت‌ نخ‌آزاد" msgid "``\"mimalloc\"``" msgstr "``\"mimalloc\"``" msgid "``mimalloc``" msgstr "``mimalloc``" msgid "Free-threaded debug build" msgstr "ساخت اشکال‌زداییِ نخ‌آزاد" msgid "``\"mimalloc_debug\"``" msgstr "``\"mimalloc_debug\"``" msgid "``mimalloc`` + debug" msgstr "``mimalloc`` + دیباگ" msgid "Legend:" msgstr "راهنما:" msgid "Name: value for :envvar:`PYTHONMALLOC` environment variable." msgstr "نام: مقدار برای متغیر محیطی :envvar:`PYTHONMALLOC`." msgid "``malloc``: system allocators from the standard C library, C functions: :c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` and :c:func:`free`." msgstr "``malloc``: تخصیص‌دهنده‌های سیستمی از کتابخانه استاندارد C، توابع C: :c:func:`malloc`، :c:func:`calloc`، :c:func:`realloc` و :c:func:`free`." msgid "``pymalloc``: :ref:`pymalloc memory allocator `." msgstr "``pymalloc``: :ref:`تخصیص‌دهنده حافظه‌ی pymalloc `." msgid "``mimalloc``: :ref:`mimalloc memory allocator `." msgstr "``mimalloc``: :ref:`تخصیص‌گر حافظه mimalloc `." msgid "\"+ debug\": with :ref:`debug hooks on the Python memory allocators `." msgstr "\"+ debug\": با :ref:`قلاب‌های اشکال‌زدایی روی تخصیص‌دهنده‌های حافظه پایتون `." msgid "\"Debug build\": :ref:`Python build in debug mode `." msgstr "«ساخت‌ اشکال‌زدایی»: :ref:`ساخت‌ پایتون در حالت اشکال‌زدایی `." msgid "Customize Memory Allocators" msgstr "سفارشی‌سازی تخصیص‌دهنده‌های حافظه" msgid "Structure used to describe a memory block allocator. The structure has the following fields:" msgstr "ساختاری که برای توصیف یک تخصیص‌دهنده بلوک حافظه استفاده می‌شود. این ساختار فیلدهای زیر را دارد:" msgid "Field" msgstr "فیلد" msgid "Meaning" msgstr "معنا" msgid "``void *ctx``" msgstr "``void *ctx``" msgid "user context passed as first argument" msgstr "زمینه کاربر که به‌عنوان آرگومان اول ارسال می‌شود" msgid "``void* malloc(void *ctx, size_t size)``" msgstr "``void* malloc(void *ctx, size_t size)``" msgid "allocate a memory block" msgstr "تخصیص دادن یک بلوک حافظه" msgid "``void* calloc(void *ctx, size_t nelem, size_t elsize)``" msgstr "``void* calloc(void *ctx, size_t nelem, size_t elsize)``" msgid "allocate a memory block initialized with zeros" msgstr "تخصیص دادن یک بلوک حافظه مقداردهی اولیه‌شده با صفر" msgid "``void* realloc(void *ctx, void *ptr, size_t new_size)``" msgstr "``void* realloc(void *ctx, void *ptr, size_t new_size)``" msgid "allocate or resize a memory block" msgstr "تخصیص دادن یا تغییر اندازه دادن یک بلوک حافظه" msgid "``void free(void *ctx, void *ptr)``" msgstr "``void free(void *ctx, void *ptr)``" msgid "free a memory block" msgstr "آزاد کردن یک بلوک حافظه" msgid "The :c:type:`!PyMemAllocator` structure was renamed to :c:type:`PyMemAllocatorEx` and a new ``calloc`` field was added." msgstr "ساختار :c:type:`!PyMemAllocator` به :c:type:`PyMemAllocatorEx` تغییر نام یافت و یک فیلد جدید ``calloc`` افزوده شد." msgid "Enum used to identify an allocator domain. Domains:" msgstr "enum برای شناسایی دامنه‌ی تخصیص‌دهنده استفاده می‌شود. دامنه‌ها:" msgid "Functions:" msgstr "توابع:" msgid ":c:func:`PyMem_RawMalloc`" msgstr ":c:func:`PyMem_RawMalloc`" msgid ":c:func:`PyMem_RawRealloc`" msgstr ":c:func:`PyMem_RawRealloc`" msgid ":c:func:`PyMem_RawCalloc`" msgstr ":c:func:`PyMem_RawCalloc`" msgid ":c:func:`PyMem_RawFree`" msgstr ":c:func:`PyMem_RawFree`" msgid ":c:func:`PyMem_Malloc`," msgstr ":c:func:`PyMem_Malloc`," msgid ":c:func:`PyMem_Calloc`" msgstr ":c:func:`PyMem_Calloc`" msgid ":c:func:`PyObject_Free`" msgstr ":c:func:`PyObject_Free`" msgid "Get the memory block allocator of the specified domain." msgstr "گرفتن تخصیص‌دهنده بلوک حافظه از دامنه‌ی مشخص‌شده." msgid "Set the memory block allocator of the specified domain." msgstr "تخصیص‌دهنده بلوک حافظه‌ی دامنه‌ی مشخص‌شده را تنظیم می‌کند." msgid "The new allocator must return a distinct non-``NULL`` pointer when requesting zero bytes." msgstr "تخصیص‌دهنده جدید باید هنگام درخواست صفر بایت، یک اشاره‌گر متمایز غیر ``NULL`` بازگرداند." msgid "For the :c:macro:`PYMEM_DOMAIN_RAW` domain, the allocator must be thread-safe: a :term:`thread state` is not :term:`attached ` when the allocator is called." msgstr "برای دامنه‌ی :c:macro:`PYMEM_DOMAIN_RAW`، تخصیص‌دهنده باید نخ‌ایمن باشد: هنگامی که تخصیص‌دهنده فراخوانی می‌شود، یک :term:`thread state` :term:`متصل ` نیست." msgid "For the remaining domains, the allocator must also be thread-safe: the allocator may be called in different interpreters that do not share a :term:`GIL`." msgstr "برای دامنه‌های باقی‌مانده، تخصیص‌دهنده باید نخ‌ایمن نیز باشد: تخصیص‌دهنده ممکن است در مفسر‌های مختلفی فراخوانی شود که یک :term:`GIL` را به اشتراک نمی‌گذارند." msgid "If the new allocator is not a hook (does not call the previous allocator), the :c:func:`PyMem_SetupDebugHooks` function must be called to reinstall the debug hooks on top on the new allocator." msgstr "اگر تخصیص‌دهنده جدید یک قلاب نباشد (تخصیص‌دهنده قبلی را فراخوانی نکند)، باید تابع :c:func:`PyMem_SetupDebugHooks` فراخوانی شود تا قلاب‌های اشکال‌زدایی مجدداً بر روی تخصیص‌دهنده جدید نصب شوند." msgid "See also :c:member:`PyPreConfig.allocator` and :ref:`Preinitialize Python with PyPreConfig `." msgstr "همچنین ببینید :c:member:`PyPreConfig.allocator` و :ref:`پیش‌راه‌اندازی پایتون با PyPreConfig `." msgid ":c:func:`PyMem_SetAllocator` does have the following contract:" msgstr ":c:func:`PyMem_SetAllocator` قرارداد زیر را دارد:" msgid "It can be called after :c:func:`Py_PreInitialize` and before :c:func:`Py_InitializeFromConfig` to install a custom memory allocator. There are no restrictions over the installed allocator other than the ones imposed by the domain (for instance, the Raw Domain allows the allocator to be called without an :term:`attached thread state`). See :ref:`the section on allocator domains ` for more information." msgstr "برای نصب یک تخصیص‌دهنده حافظه سفارشی، می‌توان آن را پس از :c:func:`Py_PreInitialize` و پیش از :c:func:`Py_InitializeFromConfig` فراخوانی کرد. هیچ محدودیتی بر تخصیص‌دهنده‌ی نصب‌شده وجود ندارد، جز محدودیت‌هایی که توسط دامنه اعمال می‌شوند (برای نمونه، دامنه خام اجازه می‌دهد که تخصیص‌دهنده بدون :term:`attached thread state` فراخوانی شود). برای اطلاعات بیشتر به :ref:`بخش دامنه‌های تخصیص‌دهنده ` مراجعه کنید." msgid "If called after Python has finish initializing (after :c:func:`Py_InitializeFromConfig` has been called) the allocator **must** wrap the existing allocator. Substituting the current allocator for some other arbitrary one is **not supported**." msgstr "اگر پس از پایان مقداردهی اولیه پایتون (پس از فراخوانی :c:func:`Py_InitializeFromConfig`) فراخوانی شود، تخصیص‌دهنده **باید** تخصیص‌دهنده موجود را دربرگیرد. جایگزین کردن تخصیص‌دهنده فعلی با تخصیص‌دهنده دلخواه دیگری **پشتیبانی نمی‌شود**." msgid "All allocators must be thread-safe." msgstr "همه‌ی تخصیص‌دهنده‌ها باید نخ‌ایمن باشند." msgid "Setup :ref:`debug hooks in the Python memory allocators ` to detect memory errors." msgstr "راه‌اندازی :ref:`قلاب‌های اشکال‌زدایی در تخصیص‌دهنده‌های حافظه پایتون ` برای تشخیص خطاهای حافظه." msgid "Debug hooks on the Python memory allocators" msgstr "قلاب‌های اشکال‌زدایی روی تخصیص‌دهنده‌های حافظه پایتون" msgid "When :ref:`Python is built in debug mode `, the :c:func:`PyMem_SetupDebugHooks` function is called at the :ref:`Python preinitialization ` to setup debug hooks on Python memory allocators to detect memory errors." msgstr "هنگامی که :ref:`پایتون در حالت اشکال‌زدایی ساخته می‌شود `، تابع :c:func:`PyMem_SetupDebugHooks` در :ref:`پیش‌مقداردهی پایتون ` فراخوانی می‌شود تا قلاب‌های اشکال‌زدایی را برای تشخیص خطاهای حافظه روی تخصیص‌دهنده‌های حافظه پایتون برپا کند." msgid "The :envvar:`PYTHONMALLOC` environment variable can be used to install debug hooks on a Python compiled in release mode (ex: ``PYTHONMALLOC=debug``)." msgstr "از متغیر محیطی :envvar:`PYTHONMALLOC` می‌توان برای نصب قلاب‌های اشکال‌زدایی روی پایتونی که در حالت انتشار کامپایل شده است، استفاده کرد (مثال: ``PYTHONMALLOC=debug``)." msgid "The :c:func:`PyMem_SetupDebugHooks` function can be used to set debug hooks after calling :c:func:`PyMem_SetAllocator`." msgstr "از تابع :c:func:`PyMem_SetupDebugHooks` می‌توان برای تنظیم قلاب‌های اشکال‌زدایی پس از فراخوانی :c:func:`PyMem_SetAllocator` استفاده کرد." msgid "These debug hooks fill dynamically allocated memory blocks with special, recognizable bit patterns. Newly allocated memory is filled with the byte ``0xCD`` (``PYMEM_CLEANBYTE``), freed memory is filled with the byte ``0xDD`` (``PYMEM_DEADBYTE``). Memory blocks are surrounded by \"forbidden bytes\" filled with the byte ``0xFD`` (``PYMEM_FORBIDDENBYTE``). Strings of these bytes are unlikely to be valid addresses, floats, or ASCII strings." msgstr "این قلاب‌های اشکال‌زدایی بلوک‌های حافظه‌ی تخصیص‌یافته به‌صورت پویا را با الگوهای بیتیِ خاص و قابل تشخیص پر می‌کنند. حافظه‌ی تازه تخصیص‌یافته با بایت ``0xCD`` (``PYMEM_CLEANBYTE``) پر می‌شود و حافظه‌ی آزادشده با بایت ``0xDD`` (``PYMEM_DEADBYTE``) پر می‌شود. اطراف بلوک‌های حافظه با «بایت‌های ممنوع» که با بایت ``0xFD`` (``PYMEM_FORBIDDENBYTE``) پر شده‌اند، احاطه شده است. رشته‌هایی از این بایت‌ها به احتمال زیاد آدرس‌های معتبر، اعداد ممیز شناور یا رشته‌های اسکی معتبر نیستند." msgid "Runtime checks:" msgstr "بررسی‌های ران‌تایم:" msgid "Detect API violations. For example, detect if :c:func:`PyObject_Free` is called on a memory block allocated by :c:func:`PyMem_Malloc`." msgstr "تشخیص نقض‌های API. برای مثال، تشخیص اینکه آیا :c:func:`PyObject_Free` روی بلوک حافظه‌ای که توسط :c:func:`PyMem_Malloc` تخصیص داده شده است، فراخوانی می‌شود یا خیر." msgid "Detect write before the start of the buffer (buffer underflow)." msgstr "تشخیص نوشتن پیش از ابتدای بافر (زیرریز بافر (buffer underflow))." msgid "Detect write after the end of the buffer (buffer overflow)." msgstr "تشخیص نوشتن فراتر از انتهای بافر (سرریز بافر)." msgid "Check that there is an :term:`attached thread state` when allocator functions of :c:macro:`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) and :c:macro:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) domains are called." msgstr "بررسی کنید که هنگام فراخوانی توابع تخصیص‌دهنده‌ی دامنه‌های :c:macro:`PYMEM_DOMAIN_OBJ` (مثلاً :c:func:`PyObject_Malloc`) و :c:macro:`PYMEM_DOMAIN_MEM` (مثلاً :c:func:`PyMem_Malloc`)، یک :term:`attached thread state` وجود داشته باشد." msgid "On error, the debug hooks use the :mod:`tracemalloc` module to get the traceback where a memory block was allocated. The traceback is only displayed if :mod:`tracemalloc` is tracing Python memory allocations and the memory block was traced." msgstr "در صورت خطا، قلاب‌های اشکال‌زدایی برای به‌دست‌آوردن ردگیری پشته‌ای که بلوک حافظه در آن تخصیص یافته است، از ماژول :mod:`tracemalloc` استفاده می‌کنند. ردگیری پشته تنها زمانی نمایش داده می‌شود که :mod:`tracemalloc` در حال ردگیری تخصیص‌های حافظه پایتون باشد و بلوک حافظه ردگیری شده باشد." msgid "Let *S* = ``sizeof(size_t)``. ``2*S`` bytes are added at each end of each block of *N* bytes requested. The memory layout is like so, where p represents the address returned by a malloc-like or realloc-like function (``p[i:j]`` means the slice of bytes from ``*(p+i)`` inclusive up to ``*(p+j)`` exclusive; note that the treatment of negative indices differs from a Python slice):" msgstr "فرض کنید *S* = ``sizeof(size_t)`` باشد. به هر یک از دو انتهای هر بلوک از *N* بایت درخواست‌شده، ``2*S`` بایت اضافه می‌شود. چیدمان حافظه به این صورت است، که در آن p نشانی بازگردانده‌شده توسط تابعی شبیه به malloc یا realloc را نشان می‌دهد (``p[i:j]`` به معنای اسلایس بایت‌ها از ``*(p+i)`` با احتساب آن تا ``*(p+j)`` بدون احتساب آن است؛ توجه داشته باشید که نحوه برخورد با اندیس‌های منفی با اسلایس پایتون متفاوت است):" msgid "``p[-2*S:-S]``" msgstr "``p[-2*S:-S]``" msgid "Number of bytes originally asked for. This is a size_t, big-endian (easier to read in a memory dump)." msgstr "تعداد بایت‌هایی که در ابتدا درخواست شده است. این یک size_t بزرگ‌اندیان است (که خواندن آن در برون‌ریزی حافظه آسان‌تر است)." msgid "``p[-S]``" msgstr "``p[-S]``" msgid "API identifier (ASCII character):" msgstr "شناسه API (نویسه اسکی):" msgid "``'r'`` for :c:macro:`PYMEM_DOMAIN_RAW`." msgstr "``'r'`` برای :c:macro:`PYMEM_DOMAIN_RAW`." msgid "``'m'`` for :c:macro:`PYMEM_DOMAIN_MEM`." msgstr "``'m'`` برای :c:macro:`PYMEM_DOMAIN_MEM`." msgid "``'o'`` for :c:macro:`PYMEM_DOMAIN_OBJ`." msgstr "``'o'`` برای :c:macro:`PYMEM_DOMAIN_OBJ`." msgid "``p[-S+1:0]``" msgstr "``p[-S+1:0]``" msgid "Copies of PYMEM_FORBIDDENBYTE. Used to catch under- writes and reads." msgstr "رونوشت‌هایی از PYMEM_FORBIDDENBYTE. برای گرفتن نوشتن‌ها و خواندن‌های پیش از ابتدای ناحیه (under-writes and reads) استفاده می‌شوند." msgid "``p[0:N]``" msgstr "``p[0:N]``" msgid "The requested memory, filled with copies of PYMEM_CLEANBYTE, used to catch reference to uninitialized memory. When a realloc-like function is called requesting a larger memory block, the new excess bytes are also filled with PYMEM_CLEANBYTE. When a free-like function is called, these are overwritten with PYMEM_DEADBYTE, to catch reference to freed memory. When a realloc- like function is called requesting a smaller memory block, the excess old bytes are also filled with PYMEM_DEADBYTE." msgstr "حافظه‌ی درخواستی با رونوشت‌هایی از PYMEM_CLEANBYTE پر می‌شود تا ارجاع به حافظه‌ی مقداردهی‌نشده رهگیری شود. هنگامی که تابعی شبیه realloc برای درخواست بلوک حافظه‌ی بزرگ‌تر فراخوانی می‌شود، بایت‌های اضافی جدید نیز با PYMEM_CLEANBYTE پر می‌شوند. هنگامی که تابعی شبیه free فراخوانی می‌شود، این بایت‌ها با PYMEM_DEADBYTE بازنویسی می‌شوند تا ارجاع به حافظه‌ی آزادشده رهگیری شود. هنگامی که تابعی شبیه realloc برای درخواست بلوک حافظه‌ی کوچک‌تر فراخوانی می‌شود، بایت‌های اضافی قدیمی نیز با PYMEM_DEADBYTE پر می‌شوند." msgid "``p[N:N+S]``" msgstr "``p[N:N+S]``" msgid "Copies of PYMEM_FORBIDDENBYTE. Used to catch over- writes and reads." msgstr "کپی‌هایی از PYMEM_FORBIDDENBYTE. برای رهگیری نوشتن‌ها و خواندن‌های خارج از محدوده استفاده می‌شوند." msgid "``p[N+S:N+2*S]``" msgstr "``p[N+S:N+2*S]``" msgid "Only used if the ``PYMEM_DEBUG_SERIALNO`` macro is defined (not defined by default)." msgstr "تنها زمانی استفاده می‌شود که ماکروی ``PYMEM_DEBUG_SERIALNO`` تعریف شده باشد (به‌طور پیش‌فرض تعریف نشده است)." msgid "A serial number, incremented by 1 on each call to a malloc-like or realloc-like function. Big-endian :c:type:`size_t`. If \"bad memory\" is detected later, the serial number gives an excellent way to set a breakpoint on the next run, to capture the instant at which this block was passed out. The static function bumpserialno() in obmalloc.c is the only place the serial number is incremented, and exists so you can set such a breakpoint easily." msgstr "شماره سریالی که در هر فراخوانی تابعی شبیه malloc یا realloc، ۱ واحد افزایش می‌یابد. :c:type:`size_t` بزرگ‌اندیان. اگر بعدها «حافظه‌ی خراب» تشخیص داده شود، شماره سریال راهی عالی فراهم می‌کند تا در اجرای بعدی نقطه‌وقفی (breakpoint) تعیین کنید و لحظه‌ی تحویل داده شدن این بلوک را به‌دست آورید. تابع ایستای bumpserialno() در obmalloc.c تنها جایی است که شماره سریال در آن افزایش می‌یابد، و وجود دارد تا شما بتوانید چنین نقطه‌وقفی را به‌سادگی تعیین کنید." msgid "A realloc-like or free-like function first checks that the PYMEM_FORBIDDENBYTE bytes at each end are intact. If they've been altered, diagnostic output is written to stderr, and the program is aborted via Py_FatalError(). The other main failure mode is provoking a memory error when a program reads up one of the special bit patterns and tries to use it as an address. If you get in a debugger then and look at the object, you're likely to see that it's entirely filled with PYMEM_DEADBYTE (meaning freed memory is getting used) or PYMEM_CLEANBYTE (meaning uninitialized memory is getting used)." msgstr "تابعی شبیه realloc یا free ابتدا بررسی می‌کند که بایت‌های PYMEM_FORBIDDENBYTE در هر دو انتها سالم باشند. اگر تغییر کرده باشند، خروجی تشخیصی به stderr نوشته می‌شود و برنامه از طریق Py_FatalError() خاتمه می‌یابد. حالت شکست اصلی دیگر، ایجاد خطای حافظه هنگامی است که برنامه یکی از الگوهای بیتی خاص را می‌خواند و تلاش می‌کند از آن به‌عنوان آدرس استفاده کند. اگر در چنین موقعیتی وارد اشکال‌زدا شوید و به شیء نگاه کنید، به احتمال زیاد می‌بینید که کاملاً با PYMEM_DEADBYTE (به این معنا که حافظه‌ی آزادشده در حال استفاده است) یا PYMEM_CLEANBYTE (به این معنا که حافظه‌ی مقداردهی‌نشده در حال استفاده است) پر شده است." msgid "The :c:func:`PyMem_SetupDebugHooks` function now also works on Python compiled in release mode. On error, the debug hooks now use :mod:`tracemalloc` to get the traceback where a memory block was allocated. The debug hooks now also check if there is an :term:`attached thread state` when functions of :c:macro:`PYMEM_DOMAIN_OBJ` and :c:macro:`PYMEM_DOMAIN_MEM` domains are called." msgstr "تابع :c:func:`PyMem_SetupDebugHooks` اکنون روی پایتونی که در حالت انتشار کامپایل شده است نیز کار می‌کند. در صورت خطا، قلاب‌های اشکال‌زدایی اکنون از :mod:`tracemalloc` برای به‌دست‌آوردن ردگیری محل تخصیص یک بلوک حافظه استفاده می‌کنند. قلاب‌های اشکال‌زدایی اکنون همچنین بررسی می‌کنند که آیا هنگام فراخوانی توابع دامنه‌های :c:macro:`PYMEM_DOMAIN_OBJ` و :c:macro:`PYMEM_DOMAIN_MEM`، یک :term:`attached thread state` وجود دارد یا خیر." msgid "Byte patterns ``0xCB`` (``PYMEM_CLEANBYTE``), ``0xDB`` (``PYMEM_DEADBYTE``) and ``0xFB`` (``PYMEM_FORBIDDENBYTE``) have been replaced with ``0xCD``, ``0xDD`` and ``0xFD`` to use the same values than Windows CRT debug ``malloc()`` and ``free()``." msgstr "الگو‌های بایتی ``0xCB`` (``PYMEM_CLEANBYTE``)، ``0xDB`` (``PYMEM_DEADBYTE``) و ``0xFB`` (``PYMEM_FORBIDDENBYTE``) با ``0xCD``، ``0xDD`` و ``0xFD`` جایگزین شده‌اند تا از همان مقادیر ``malloc()`` و ``free()`` اشکال‌زدایی CRT ویندوز استفاده شود." msgid "The pymalloc allocator" msgstr "تخصیص‌دهنده‌ی pymalloc" msgid "Python has a *pymalloc* allocator optimized for small objects (smaller or equal to 512 bytes) with a short lifetime. It uses memory mappings called \"arenas\" with a fixed size of either 256 KiB on 32-bit platforms or 1 MiB on 64-bit platforms. It falls back to :c:func:`PyMem_RawMalloc` and :c:func:`PyMem_RawRealloc` for allocations larger than 512 bytes." msgstr "پایتون یک تخصیص‌دهنده *pymalloc* دارد که برای اشیاء کوچک (کوچک‌تر یا برابر با ۵۱۲ بایت) با عمر کوتاه بهینه‌سازی شده است. این تخصیص‌دهنده از نگاشت‌های حافظه به نام «آرنا» با اندازه ثابت ۲۵۶ KiB در سکوهای ۳۲ بیتی یا ۱ MiB در سکوهای ۶۴ بیتی استفاده می‌کند. برای تخصیص‌های بزرگ‌تر از ۵۱۲ بایت، به :c:func:`PyMem_RawMalloc` و :c:func:`PyMem_RawRealloc` بازمی‌گردد." msgid "*pymalloc* is the :ref:`default allocator ` of the :c:macro:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) and :c:macro:`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) domains." msgstr "*pymalloc* :ref:`تخصیص‌دهنده پیش‌فرض ` دامنه‌های :c:macro:`PYMEM_DOMAIN_MEM` (مثلاً :c:func:`PyMem_Malloc`) و :c:macro:`PYMEM_DOMAIN_OBJ` (مثلاً :c:func:`PyObject_Malloc`) است." msgid "The arena allocator uses the following functions:" msgstr "تخصیص‌دهنده‌ی آرنا (arena allocator) از توابع زیر استفاده می‌کند:" msgid ":c:func:`!VirtualAlloc` and :c:func:`!VirtualFree` on Windows," msgstr ":c:func:`!VirtualAlloc` و :c:func:`!VirtualFree` در ویندوز،" msgid ":c:func:`!mmap` and :c:func:`!munmap` if available," msgstr ":c:func:`!mmap` و :c:func:`!munmap` در صورت دسترسی‌پذیری،" msgid ":c:func:`malloc` and :c:func:`free` otherwise." msgstr ":c:func:`malloc` و :c:func:`free` در غیر این صورت." msgid "This allocator is disabled if Python is configured with the :option:`--without-pymalloc` option. It can also be disabled at runtime using the :envvar:`PYTHONMALLOC` environment variable (ex: ``PYTHONMALLOC=malloc``)." msgstr "اگر پایتون با گزینه‌ی :option:`--without-pymalloc` پیکربندی شده باشد، این تخصیص‌دهنده غیرفعال می‌شود. همچنین می‌توان آن را در زمان اجرا با استفاده از متغیر محیطی :envvar:`PYTHONMALLOC` غیرفعال کرد (مثلاً ``PYTHONMALLOC=malloc``)." msgid "Typically, it makes sense to disable the pymalloc allocator when building Python with AddressSanitizer (:option:`--with-address-sanitizer`) which helps uncover low level bugs within the C code." msgstr "معمولاً منطقی است که هنگام ساخت پایتون با AddressSanitizer (:option:`--with-address-sanitizer`)، که به کشف اشکال‌های سطح پایین درون کد C کمک می‌کند، تخصیص‌دهنده pymalloc را غیرفعال کنید." msgid "Customize pymalloc Arena Allocator" msgstr "سفارشی‌سازی تخصیص‌دهنده آرنا (Arena Allocator) در pymalloc" msgid "Structure used to describe an arena allocator. The structure has three fields:" msgstr "ساختاری که برای توصیف یک تخصیص‌دهنده‌ی آرنا (arena allocator) استفاده می‌شود. این ساختار سه فیلد دارد:" msgid "``void* alloc(void *ctx, size_t size)``" msgstr "``void* alloc(void *ctx, size_t size)``" msgid "allocate an arena of size bytes" msgstr "تخصیص دادن یک آرنا به اندازه‌ی size بایت" msgid "``void free(void *ctx, void *ptr, size_t size)``" msgstr "``void free(void *ctx, void *ptr, size_t size)``" msgid "free an arena" msgstr "آزاد کردن یک آرنا" msgid "Get the arena allocator." msgstr "بهدست آوردن تخصیص‌دهنده‌ی آرنا ." msgid "Set the arena allocator." msgstr "تخصیص‌دهنده‌ی آرنا را تنظیم می‌کند." msgid "The mimalloc allocator" msgstr "تخصیص‌دهنده mimalloc" msgid "Python supports the `mimalloc `__ allocator when the underlying platform support is available. mimalloc is a general purpose allocator with excellent performance characteristics, initially developed by Daan Leijen for the runtime systems of the Koka and Lean languages." msgstr "پایتون از تخصیص‌دهنده `mimalloc `__ پشتیبانی می‌کند، زمانی که پشتیبانی پلتفرم زیرین در دسترس باشد. mimalloc یک تخصیص‌دهنده همه‌منظوره با ویژگی‌های عملکردی عالی است که در ابتدا توسط Daan Leijen برای سیستم‌های ران‌تایم زبان‌های Koka و Lean توسعه‌یافته است." msgid "Unlike :ref:`pymalloc `, which is optimized for small objects (512 bytes or fewer), mimalloc handles allocations of any size." msgstr "برخلاف :ref:`pymalloc ` که برای اشیاء کوچک (۵۱۲ بایت یا کمتر) بهینه‌سازی‌شده است، mimalloc تخصیص‌هایی با هر اندازه را مدیریت می‌کند." msgid "In the :term:`free-threaded ` build, mimalloc is the default and **required** allocator for the :c:macro:`PYMEM_DOMAIN_MEM` and :c:macro:`PYMEM_DOMAIN_OBJ` domains. It cannot be disabled in free-threaded builds. The free-threaded build uses per-thread mimalloc heaps, which allows allocation and deallocation to proceed without locking in most cases." msgstr "در ساخت‌ :term:`نخ‌آزاد `، mimalloc تخصیص‌دهنده‌ی پیش‌فرض و **الزامی** برای دامنه‌های :c:macro:`PYMEM_DOMAIN_MEM` و :c:macro:`PYMEM_DOMAIN_OBJ` است. در ساخت‌های نخ‌آزاد نمی‌توان آن را غیرفعال کرد. ساخت‌ نخ‌آزاد از هیپ‌های mimalloc به ازای هر نخ استفاده می‌کند که این امر اجازه می‌دهد تخصیص و آزادسازی در بیشتر موارد بدون قفل‌کردن انجام شوند." msgid "In the default (non-free-threaded) build, mimalloc is available but not the default allocator. It can be selected at runtime using :envvar:`PYTHONMALLOC`\\ ``=mimalloc`` (or ``mimalloc_debug`` to include :ref:`debug hooks `). It can be disabled at build time using the :option:`--without-mimalloc` configure option, but this option cannot be combined with :option:`--disable-gil`." msgstr "در ساخت‌ پیش‌فرض (غیر نخ‌آزاد)، mimalloc دسترس‌پذیر است، اما تخصیص‌دهنده‌ی پیش‌فرض نیست. می‌توان آن را در زمان اجرا با استفاده از :envvar:`PYTHONMALLOC`\\ ``=mimalloc`` انتخاب کرد (یا ``mimalloc_debug`` برای گنجاندن :ref:`قلاب‌های اشکال‌زدایی `). می‌توان آن را در زمان ساخت‌ با استفاده از گزینه‌ی پیکربندی :option:`--without-mimalloc` غیرفعال کرد، اما این گزینه را نمی‌توان با :option:`--disable-gil` ترکیب کرد." msgid "tracemalloc C API" msgstr "API زبان C برای tracemalloc" msgid "Track an allocated memory block in the :mod:`tracemalloc` module." msgstr "پیگیری یک بلوک حافظه‌ی تخصیص‌یافته در ماژول :mod:`tracemalloc`." msgid "Return ``0`` on success, return ``-1`` on error (failed to allocate memory to store the trace). Return ``-2`` if tracemalloc is disabled." msgstr "در صورت موفقیت ``0`` را برمی‌گرداند، در صورت خطا ``-1`` را برمی‌گرداند (تخصیص حافظه برای ذخیره‌ی ردگیری ناموفق بود). اگر tracemalloc غیرفعال باشد، ``-2`` را برمی‌گرداند." msgid "If memory block is already tracked, update the existing trace." msgstr "اگر بلوک حافظه از قبل پیگیری شده باشد، ردگیری موجود به‌روزرسانی می‌شود." msgid "Untrack an allocated memory block in the :mod:`tracemalloc` module. Do nothing if the block was not tracked." msgstr "پیگیری یک بلوک حافظه‌ی تخصیص‌یافته را در ماژول :mod:`tracemalloc` لغو می‌کند. اگر بلوک پیگیری نشده باشد، هیچ کاری انجام نمی‌دهد." msgid "Return ``-2`` if tracemalloc is disabled, otherwise return ``0``." msgstr "اگر tracemalloc غیرفعال باشد، ``-2`` را برمی‌گرداند، در غیر این صورت ``0`` را برمی‌گرداند." msgid "Examples" msgstr "مثال‌ها" msgid "Here is the example from section :ref:`memoryoverview`, rewritten so that the I/O buffer is allocated from the Python heap by using the first function set::" msgstr "اینجا مثال بخش :ref:`memoryoverview` آمده است که به‌گونه‌ای بازنویسی شده است تا بافر ورودی/خروجی با استفاده از نخستین مجموعه توابع، از هیپ پایتون تخصیص یابد::" msgid "" "PyObject *res;\n" "char *buf = (char *) PyMem_Malloc(BUFSIZ); /* for I/O */\n" "\n" "if (buf == NULL)\n" " return PyErr_NoMemory();\n" "/* ...Do some I/O operation involving buf... */\n" "res = PyBytes_FromString(buf);\n" "PyMem_Free(buf); /* allocated with PyMem_Malloc */\n" "return res;" msgstr "" "PyObject *res;\n" "char *buf = (char *) PyMem_Malloc(BUFSIZ); /* for I/O */\n" "\n" "if (buf == NULL)\n" " return PyErr_NoMemory();\n" "/* ...Do some I/O operation involving buf... */\n" "res = PyBytes_FromString(buf);\n" "PyMem_Free(buf); /* allocated with PyMem_Malloc */\n" "return res;" msgid "The same code using the type-oriented function set::" msgstr "همان کد با استفاده از مجموعه توابع نوع‌محور::" msgid "" "PyObject *res;\n" "char *buf = PyMem_New(char, BUFSIZ); /* for I/O */\n" "\n" "if (buf == NULL)\n" " return PyErr_NoMemory();\n" "/* ...Do some I/O operation involving buf... */\n" "res = PyBytes_FromString(buf);\n" "PyMem_Free(buf); /* allocated with PyMem_New */\n" "return res;" msgstr "" "PyObject *res;\n" "char *buf = PyMem_New(char, BUFSIZ); /* for I/O */\n" "\n" "if (buf == NULL)\n" " return PyErr_NoMemory();\n" "/* ...Do some I/O operation involving buf... */\n" "res = PyBytes_FromString(buf);\n" "PyMem_Free(buf); /* allocated with PyMem_New */\n" "return res;" msgid "Note that in the two examples above, the buffer is always manipulated via functions belonging to the same set. Indeed, it is required to use the same memory API family for a given memory block, so that the risk of mixing different allocators is reduced to a minimum. The following code sequence contains two errors, one of which is labeled as *fatal* because it mixes two different allocators operating on different heaps. ::" msgstr "توجه داشته باشید که در دو مثال بالا، بافر همیشه از طریق توابعی که به یک مجموعه تعلق دارند دستکاری می‌شود. در واقع، لازم است برای یک بلوک حافظه‌ی معین از یک خانواده‌ی واحد API حافظه استفاده شود تا خطر ترکیب تخصیص‌دهنده‌های مختلف به حداقل کاهش یابد. دنباله کد زیر شامل دو خطا است که یکی از آن‌ها به‌عنوان *مهلک* برچسب‌گذاری شده است، زیرا دو تخصیص‌دهنده‌ی متفاوت را که بر روی هیپ‌های متفاوت کار می‌کنند، با هم ترکیب می‌کند. ::" msgid "" "char *buf1 = PyMem_New(char, BUFSIZ);\n" "char *buf2 = (char *) malloc(BUFSIZ);\n" "char *buf3 = (char *) PyMem_Malloc(BUFSIZ);\n" "...\n" "PyMem_Del(buf3); /* Wrong -- should be PyMem_Free() */\n" "free(buf2); /* Right -- allocated via malloc() */\n" "free(buf1); /* Fatal -- should be PyMem_Free() */" msgstr "" "char *buf1 = PyMem_New(char, BUFSIZ);\n" "char *buf2 = (char *) malloc(BUFSIZ);\n" "char *buf3 = (char *) PyMem_Malloc(BUFSIZ);\n" "...\n" "PyMem_Del(buf3); /* Wrong -- should be PyMem_Free() */\n" "free(buf2); /* Right -- allocated via malloc() */\n" "free(buf1); /* Fatal -- should be PyMem_Free() */" msgid "In addition to the functions aimed at handling raw memory blocks from the Python heap, objects in Python are allocated and released with :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar` and :c:func:`PyObject_Free`." msgstr "علاوه بر توابعی که برای مدیریت بلوک‌های حافظه خام از هیپ پایتون در نظر گرفته شده‌اند، اشیاء در پایتون با :c:macro:`PyObject_New`، :c:macro:`PyObject_NewVar` و :c:func:`PyObject_Free` تخصیص می‌یابند و آزاد می‌شوند." msgid "These will be explained in the next chapter on defining and implementing new object types in C." msgstr "این موارد در فصل بعدی که به تعریف و پیاده‌سازی نوع‌های شیء جدید در C می‌پردازد، توضیح داده خواهند شد." msgid "malloc (C function)" msgstr "malloc (تابع C)" msgid "calloc (C function)" msgstr "calloc (تابع C)" msgid "realloc (C function)" msgstr "realloc (تابع C)" msgid "free (C function)" msgstr "free (تابع C)"