|
The change looks good, but it will need a test and a machine large enough to test it on. |
Sorry, something went wrong.
|
I used GCP n2d-standard-16 (64GiB RAM): inada.naoki@instance-1:~/cpython$ /usr/bin/time ./python -m test -vM 64g -m DictTest test_bigmem
== CPython 3.12.0a6+ (heads/main-dirty:1c9f3391b9, Mar 16 2023, 08:21:15) [GCC 12.2.0]
== Linux-5.19.0-1015-gcp-x86_64-with-glibc2.36 little-endian
== Python build: debug
== cwd: /home/inada.naoki/cpython/build/test_python_3512æ
== CPU count: 16
== encodings: locale=UTF-8, FS=utf-8
0:00:00 load avg: 0.51 Run tests sequentially
0:00:00 load avg: 0.51 [1/1] test_bigmem
test_dict (test.test_bigmem.DictTest.test_dict) ...
... expected peak memory use: 53.3G
... process data size: 0.1G
... process data size: 0.5G
... process data size: 0.9G
... process data size: 1.4G
(snip)
... process data size: 51.7G
... process data size: 51.7G
... process data size: 41.0G
(snip)
... process data size: 20.0G
ok
----------------------------------------------------------------------
Ran 1 test in 123.835s
OK
test_bigmem passed in 2 min 3 sec
== Tests result: SUCCESS ==
1 test OK.
Total duration: 2 min 3 sec
Tests result: SUCCESS
106.85user 17.31system 2:04.05elapsed 100%CPU (0avgtext+0avgdata 53939612maxresident)k
0inputs+0outputs (0major+16111371minor)pagefaults 0swaps
53939612maxresident)k is 51.44GiB. So expected peak memory use: 53.3G is accurate enough. |
Sorry, something went wrong.
| assert(log2_size >= PyDict_LOG_MINSIZE); | ||
|
|
||
| usable = USABLE_FRACTION(1<<log2_size); | ||
| usable = USABLE_FRACTION((size_t)1<<log2_size); |
There was a problem hiding this comment.
I am asking for my curiosity(to become familiar with cpython); How does casting the result of 1<<log2_size to size_t fix the overflow in the dict?
Sorry, something went wrong.
There was a problem hiding this comment.
1 is int. And int is 32bit on most platforms. So 1 << 32 will overflow.
Here is example:
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks!
Sorry, something went wrong.
|
Thanks @methane for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11. |
Sorry, something went wrong.
|
GH-102777 is a backport of this pull request to the 3.11 branch. |
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.