Python Classes - Memory Allocation and Garbage Collection

Pubblicato il: 10 novembre 2021
sul canale di: Appficial
1,642
17

Memory allocation is the process of granting and allocating memory when an application requests it.

The python runtime automatically allocates memory for your objects, such as lists, dictionaries, etc. It does this by requesting memory from your operating system. An application cannot use memory that is not allocated.

In some programming languages, like C++, the programmer is responsible for memory allocation. However, with Python, all the memory allocation is done by the Python runtime, which makes things easier.

Garbage collection is the process of deallocating memory in an application

A reference count is an integer that counts the number of times a variable is referencing an object, and the garbage collector deallocates the object if that reference count = 0

Note that the time an object is deallocated after the reference count becomes 0 may differ across different Python runtime implementations.

Subscribe to Appficial for more programming videos coming soon. Also, don't forget to click LIKE and comment on the video if it helped you out!


In questa pagina del sito puoi guardare il video online Python Classes - Memory Allocation and Garbage Collection della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Appficial 10 novembre 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 1,642 volte e gli è piaciuto 17 spettatori. Buona visione!