Message366854
I afraid that this is a part of the larger issue (see also issue31165). Seems the cause is that the GIL can be released when allocate or reallocate the memory. Does your project use some memory managing hooks?
Using sys.modules.copy().items() can help a lot, because you allocate memory for new dict only once. In case of list(sys.modules.items()) you allocate memory for every key-value pair, and may allocate memory several times to resize a list.
This reduces the probability of occurring the problem in many times, but not to zero. There is still a chance that the size of the original dict increase when you allocate a memory for a new dict, so copying the data to a new dict can fail or even crash or spoil the memory. |
|
Date |
User |
Action |
Args |
2020-04-20 16:33:11 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger, Markus Mohrhard |
2020-04-20 16:33:11 | serhiy.storchaka | set | messageid: <1587400391.11.0.982432007665.issue40327@roundup.psfhosted.org> |
2020-04-20 16:33:11 | serhiy.storchaka | link | issue40327 messages |
2020-04-20 16:33:11 | serhiy.storchaka | create | |
|