def action(self, params):
            count = {}
            size = {}
            total_size = 0
            unreachable = gc.collect()
            for obj in gc.get_objects():
                inst_name = type(obj).__name__
                c = count.get(inst_name, None)
                if not c:
                    count[inst_name] = 0
                s = size.get(inst_name, None)
                if not s:
                    size[inst_name] = 0

                count[inst_name] += 1
                s = sys.getsizeof(obj)
                size[inst_name] += s
                total_size += s

            # Total size in MB

            total_size = total_size // 1000000
            ret = {
                'unreachable': unreachable,
                'total': total_size,
                'summary': []}

            for class_name, s in size.items():
                # Calculate size in MB
                size_mb = s // 1000000
                # We are only interested in class which take-up more than a MB
                if size_mb > 0:
                    ret['summary'].append(
                        {
                            'class': class_name,
                            'instances': count.get(class_name, None),
                            'size': size_mb
                        }
                    )

            return CommandsResponse(STATUS_OK, ret)
dataset/ETHPy150Open osrg/ryu/ryu/services/protocols/bgp/operator/commands/show/memory.py/Memory.Summary.action/original