tests: add get_alloced_bytes function