Am 07.04.2011 02:06, schrieb Chris Angelico: > On Thu, Apr 7, 2011 at 6:38 AM, Martin v. Loewis <mar...@v.loewis.de> wrote: >> You can adjust the implementations of PyMem_Malloc and PyObject_Malloc. >> This would catch many allocations, but not all of them. If you adjust >> PyMem_MALLOC instead of PyMem_Malloc, you catch even more allocations - >> but extensions modules which directly call malloc() still would bypass >> this accounting. > > I'm not too concerned about extensions, here; in any case, I lock most > of them off. I just want to prevent stupid stuff like this: > > a='a' > while True: > a+=a
That would certainly be caught by instrumenting PyObject_MALLOC. More generally, I believe that if you instrument the functions I mentioned, your use case is likely covered. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list