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 2024-04-24 23:28:29 +0100

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.

edit retag flag offensive close merge delete

Comments

Please provide an actual code illustrating the question.

Max Alekseyev gravatar imageMax Alekseyev ( 2024-04-25 01:55:36 +0100 )edit

.

# 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 ( 2024-04-25 13:06:51 +0100 )edit

FWIW, the same thng happens on Python.

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2024-04-25 18:58:48 +0100 )edit