Reply To: DESFireEV1 getFreeMemory() returns more available memory than getTotalMemory()

Forum MIFARE SDK DESFireEV1 getFreeMemory() returns more available memory than getTotalMemory() Reply To: DESFireEV1 getFreeMemory() returns more available memory than getTotalMemory()

Re: DESFireEV1 getFreeMemory() returns more available memory than getTotalMemory()

14. February 2017 at 15:29
Hello Francisco,

If I talk with “DESFire experts” they say to me: please forgot getTotalMemory()! This method has nothing to do with memory management on the target. This method only returns the brand name: “DESFire EV1 4K”. But “4K” is not exact 4096 bytes as it implies! The same is true for other sizes 2K and 8K.

They also make clear, you cannot expect after creating a file with the size of lets say 128 bytes that the amount of free memory is exact 128 bytes less. It could be more! Therefore they implement FreeMemory (which is used by Taplinx method getFreeMemory()) as native command to return the current amount of free memory. There is no in public published rule where you can re-calculate the exact byte sizes after some actions on the DESFire.

After all the discussions about this topic, I come to the end that only getFreeMemory() should be used in calculations and the “brand name size of 4K=4096” should be ignored.

Please forgot my code snippet in the previous post. It caused more confusion than it helps. As I explained before, you cannot trust exact byte size calculations. The internal management might always take memory space and you should reflect that in being conservative in your memory requirement and use getFreeMemory() to get the “real” current free size.

The TapLinx team

+ 0  |  - 0