(self, frame, event, arg)
| 811 | return self.trace_memory_usage |
| 812 | |
| 813 | def trace_max_mem(self, frame, event, arg): |
| 814 | # run into PDB as soon as memory is higher than MAX_MEM |
| 815 | if event in ('line', 'return') and frame.f_code in self.code_map: |
| 816 | c = _get_memory(-1, self.backend, filename=frame.f_code.co_filename) |
| 817 | if c >= self.max_mem: |
| 818 | t = ('Current memory {0:.2f} MiB exceeded the ' |
| 819 | 'maximum of {1:.2f} MiB\n'.format(c, self.max_mem)) |
| 820 | sys.stdout.write(t) |
| 821 | sys.stdout.write('Stepping into the debugger \n') |
| 822 | frame.f_lineno -= 2 |
| 823 | p = pdb.Pdb() |
| 824 | p.quitting = False |
| 825 | p.stopframe = frame |
| 826 | p.returnframe = None |
| 827 | p.stoplineno = frame.f_lineno - 3 |
| 828 | p.botframe = None |
| 829 | return p.trace_dispatch |
| 830 | |
| 831 | if self._original_trace_function is not None: |
| 832 | (self._original_trace_function)(frame, event, arg) |
| 833 | |
| 834 | return self.trace_max_mem |
| 835 | |
| 836 | def __enter__(self): |
| 837 | self.enable_by_count() |
nothing calls this directly
no test coverage detected