Issue 3418: heavy resource usage with string functions (original) (raw)
Issue3418
Created on 2008-07-19 14:02 by mgogoulos, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (3) | ||
---|---|---|
msg70034 - (view) | Author: mgogoulos (mgogoulos) | Date: 2008-07-19 14:02 |
Not sure if this is a bug, however the following string functions when called with very big numbers as the padding arguments consume great system resources. My estimation is that it would help to exist a limit on what can be specified as width. Check (center, ljust, rjust, zfill) eg. import string string.center('..', 2147483647) Tested on python versions: 2.5.1 and 2.5.2 | ||
msg70037 - (view) | Author: Facundo Batista (facundobatista) * ![]() |
Date: 2008-07-19 14:51 |
The issue is that you're creating a string of 2GB. It's expectable that it'll use a lot of resources. Test this, for example: >>> a = "." * 2147483647 | ||
msg70039 - (view) | Author: Martin v. Löwis (loewis) * ![]() |
Date: 2008-07-19 15:31 |
As for the possibility of rejecting the request: Python should absolutely not do so. If the user/applications wants to compute the result, and the system has enough virtual memory, then Python should provide the result. If you want to limit how much memory Python can consume, use the operating system's resource management functions (such as ulimit). |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:36 | admin | set | github: 47668 |
2008-07-19 15:31:51 | loewis | set | nosy: + loewismessages: + |
2008-07-19 14:51:37 | facundobatista | set | status: open -> closedresolution: not a bugmessages: + nosy: + facundobatista |
2008-07-19 14:02:50 | mgogoulos | create |