The ION_IOC_MAP/ION_IOC_SHARE ioctls take a reference to an ion buffer. If the fd generated by the ioctl is never closed, the buffer will never be freed. This is a pain to track down in userspace. Add a debugfs entry to do a scan of all the buffers and check which ones have no handle associated with them. If a buffer has no handle associated with it, that means the last reference is an fd. There isn't a good way to directly associate an fd with a buffer, but this can at least be a starting point for tracking down leaks. Change-Id: I64eedd6a30d8298b2aa75532c7fad506542910f6 Signed-off-by: Laura Abbott <lauraa@codeaurora.org>