Your RAM is your wallet. Your allocations are your money. Your pointers are your receipts.
Instead of treating malloc() and free() like abstract low-level calls, you can think of memory like a wallet:
alloc= reserve money in a blockfree= return a block to the walletmemory= check what is currently reservedleaks= see what is still active
Under the hood, the C engine does the real work with malloc() and free(), while the Python CLI gives you a simple wallet-style interface using Rich.
gcc -shared -fPIC memory.c -o libmemory.so
python3 cli.pyπ° Allocation = reserving money in a block
π§Ύ Pointer = receipt used to find it again
πΈ Free = return the money
π Memory leak = money still reserved, but the receipt is lost
wallet> alloc 64
π° You received 64 bytes
π¦ Block created
π Address: 0x55c5726f4780
wallet> free 0x55c5726f4780
ποΈ Block returned
wallet> leaks
π No memory leaks