MCPcopy Create free account
hub / github.com/ScrapeGraphAI/toonify / sizeof

Function sizeof

benchmark/memory_benchmark.py:27–39  ·  view source on GitHub ↗
(o)

Source from the content-addressed store, hash-verified

25 seen = set()
26
27 def sizeof(o):
28 if id(o) in seen:
29 return 0
30 seen.add(id(o))
31
32 size = sys.getsizeof(o)
33
34 if isinstance(o, Mapping):
35 size += sum(sizeof(k) + sizeof(v) for k, v in o.items())
36 elif isinstance(o, Iterable) and not isinstance(o, (str, bytes, bytearray)):
37 size += sum(sizeof(item) for item in o)
38
39 return size
40
41 return sizeof(obj)
42

Callers 1

get_memory_sizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…