why numpy array has size of 112 byte and when I do flatten it, it has 96 byte of memory?
As Derte mentioned, sys.getsizeof doesn't say the size of the array. The 96 you got is holding information about the array (if it's 1-Dimensional) and the 112 if it's multi dimensional. Any additional element will increase the size with 8 bytes assuming you are using a dtype=int64.
I have a numpy array and I flatten it by np.ravel() and I am confused when i tried to learn the size of the both array



array =np.arange(15).reshape(3,5)
sys.getsizeof(array)
      112
sys.getsizeof(array.ravel())
      96
array.size
      15
array.ravel().size
      15



 



array = np.arange(30).reshape(5,6)
sys.getsizeof(array)
      112
sys.getsizeof(array.ravel())
      96
array.size
      30



As seen above two different arrays have the same memory size but each has different amount of element. Why does it happen?