This sys module provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter. It provides information about constants, functions and methods of python interpreter. It can be used for manipulating Python runtime environment.
sys.getallocatedblocks() is used to get number of memory blocks currently allocated by the interpreter, regardless of their size. This function is mainly useful for tracking and debugging memory leaks. To get more predictable results, we may have to call
Parameter: This method accepts no parameter.
Return Value: This method returns the number of memory blocks currently allocated by the interpreter but if it cannot reasonably compute this information then 0 is returned.
Example #1 :
sys.getallocatedblocks() method to find the memory allocated to interpreter.
- class method vs static method in Python
- Python | next() method
- Python | set() method
- Python | os.dup() method
- Python | shutil.which() method
- Python | PyTorch sin() method
- Python | os.sched_getaffinity() method
- Python | os.sched_setaffinity() method
- Python | os.sched_get_priority_min() method
- Python | os.kill() method
- Python | os.minor() method
- Python | os.renames() method
- Python | sympy.apart() method
- Python | os.getcwd() method
- Python | os.ftruncate() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.