Is there a function in SageMath that gives the actual size of a variable not of a pointer to the variable? I used "getsizeof" function but the size it showed is very small comparing to the long of the equation is.

asked 1 year ago

anonymous user

Anonymous

I used "get sizeof" function in order to provide me with the size of equations that are stored in the memory, but the size it provided is not reasonable comparing to the length of the equations.

Preview: (hide)

Comments

Please provide an actual code illustrating the question.

Max Alekseyev gravatar imageMax Alekseyev ( 1 year ago )

.

# Measure and display the size of each function in P
for i, func in enumerate(P):
    size_in_bytes = sys.getsizeof(func)
    show(f"Size of P[{i}] (function for state {all_states[i]}): {size_in_bytes} bytes")

I am looking for alternative command of "getsizeof" as it is not measuring the actual size of my functions P. it gives all functions have same size 56 bytes which it can't be as there length are different

aqnora21 gravatar imageaqnora21 ( 1 year ago )

FWIW, the same thng happens on Python.

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 1 year ago )