Sandboxed Python: memory limits?
Martin v. Loewis
martin at v.loewis.de
Thu Apr 7 04:01:39 EDT 2011
Am 07.04.2011 02:06, schrieb Chris Angelico:
> On Thu, Apr 7, 2011 at 6:38 AM, Martin v. Loewis <martin at 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:
> while True:
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.
More information about the Python-list