teachpyx.tools.helpers¶
- teachpyx.tools.helpers.total_size(o, handlers=None)[source][source]¶
Returns the approximate memory footprint an object and all of its contents.
- Paramètres:
o – object to measure
handlers – for recursivity purpose
- Renvoie:
total size
Automatically finds the contents of the following builtin containers and their subclasses: tuple, list, deque, dict, set and frozenset. To search other containers, add handlers to iterate over their contents:
handlers = {SomeContainerClass: iter, OtherContainerClass: OtherContainerClass.get_elements}
Source: getsizeof.