Repository navigation
Commit 30124d4
[Python 3] fix python_parser test
Closing the interpreter is bugged.
The idea to remove Py_Finalize comes from numpy/numpy#8097
Those discussions also provide a way to try to clean a bit. Here are
some test results of the memory loss on the python_parser test:
- python3
- with Py_Finalize
unknown location(0): fatal error in "buildModel": memory access violation at address: 0x000000a0: no mapping at fault address
- with the workaround
> HEAP SUMMARY:
> in use at exit: 6,623,041 bytes in 11,478 blocks
> total heap usage: 40,988 allocs, 29,510 frees, 35,627,810 bytes allocated
>
> LEAK SUMMARY:
> definitely lost: 162,918 bytes in 86 blocks
> indirectly lost: 0 bytes in 0 blocks
> possibly lost: 224,284 bytes in 192 blocks
> still reachable: 6,235,839 bytes in 11,200 blocks
> suppressed: 0 bytes in 0 blocks
>
> ERROR SUMMARY: 1470 errors from 115 contexts (suppressed: 0 from 0)
- with nothing
> HEAP SUMMARY:
> in use at exit: 6,652,431 bytes in 11,580 blocks
> total heap usage: 40,937 allocs, 29,357 frees, 35,604,459 bytes allocated
>
> LEAK SUMMARY:
> definitely lost: 164,417 bytes in 87 blocks
> indirectly lost: 0 bytes in 0 blocks
> possibly lost: 223,187 bytes in 191 blocks
> still reachable: 6,264,827 bytes in 11,302 blocks
> suppressed: 0 bytes in 0 blocks
>
> ERROR SUMMARY: 1438 errors from 107 contexts (suppressed: 0 from 0)
- python 2
- with Py_Finalize:
> HEAP SUMMARY:
> in use at exit: 3,209,728 bytes in 5,514 blocks
> total heap usage: 23,363 allocs, 17,849 frees, 27,441,910 bytes allocated
>
> LEAK SUMMARY:
> definitely lost: 0 bytes in 0 blocks
> indirectly lost: 0 bytes in 0 blocks
> possibly lost: 161,830 bytes in 89 blocks
> still reachable: 3,047,898 bytes in 5,425 blocks
> suppressed: 0 bytes in 0 blocks
>
> ERROR SUMMARY: 1902 errors from 95 contexts (suppressed: 0 from 0)
- with the workaround:
> HEAP SUMMARY:
> in use at exit: 5,437,170 bytes in 7,454 blocks
> total heap usage: 23,363 allocs, 15,909 frees, 27,441,795 bytes allocated
>
> LEAK SUMMARY:
> definitely lost: 0 bytes in 0 blocks
> indirectly lost: 0 bytes in 0 blocks
> possibly lost: 177,798 bytes in 115 blocks
> still reachable: 5,259,372 bytes in 7,339 blocks
> suppressed: 0 bytes in 0 blocks
>
> ERROR SUMMARY: 1149 errors from 69 contexts (suppressed: 0 from 0)
- with nothing:
>
> HEAP SUMMARY:
> in use at exit: 5,472,144 bytes in 7,554 blocks
> total heap usage: 23,361 allocs, 15,807 frees, 27,440,943 bytes allocated
>
> LEAK SUMMARY:
> definitely lost: 0 bytes in 0 blocks
> indirectly lost: 0 bytes in 0 blocks
> possibly lost: 178,318 bytes in 116 blocks
> still reachable: 5,293,826 bytes in 7,438 blocks
> suppressed: 0 bytes in 0 blocks
>
> ERROR SUMMARY: 1150 errors from 67 contexts (suppressed: 0 from 0)
So I think we should keep Py_Finalize as long as it works (ie. for
Python 2), and use the workaround otherwise.1 parent e38622e commit 30124d4
1 file changed
Lines changed: 30 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
71 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
72 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
73 | 102 | | |
74 | 103 | | |
75 | 104 | | |
76 | 105 | | |
77 | 106 | | |
78 | | - | |
| |||
0 commit comments