Php – How to find memory used by an object in PHP? (sizeof)

memorymemory-managementphp

How to find memory used by an object in PHP? (c's sizeof). The object I want to find out about is a dictionary with strings and ints in it so it makes it hard to calculate it manually. Also string in php can be of varied length depending on encoding (utf8 etc) correct?

Best Solution

You could use memory_get_usage().

Run it once before creating your object, then again after creating your object, and take the difference between the two results.