Commit 03a6101
inspect memory limit fix (#100)
Add time and memory limit checks for `inspect` and `to_s`
Some automatic UI-related queries to the debugger may cause
OOM or hangs in the case of recursive or just very large data
structures being inspected. This commit adds the possibility
(enabled by default) to add time and memory limits for dangerous
calls to objects from a user codebase.
Related: RUBY-18275, RUBY-18121, RUBY-19520.
Commits reviewed and squashed:
* inspect memory limit
* cleanup
* Option to disable memory check is added
* disable memory limit in the same option
* cleanup: formating fix, rename variable, rewrite on "compact = if (...)"
* fixed exeption message
* memory limit logging added
* debug output deleted
* print_msg -> print_debug
* object_id deleted from the exeption message
* Fixes according to the review
* timelimit for inspect evaluation added
* The handler is called with a probability of 25%
* cleanup
* inspect_with_alloc_control -> exec_with_... and heuristic break for variable inspect
* fixes according to reiew1 parent 43b57a0 commit 03a6101
2 files changed
+87
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
39 | 50 | | |
40 | 51 | | |
41 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
7 | 28 | | |
8 | 29 | | |
9 | 30 | | |
| |||
137 | 158 | | |
138 | 159 | | |
139 | 160 | | |
140 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
141 | 200 | | |
142 | 201 | | |
143 | 202 | | |
| |||
157 | 216 | | |
158 | 217 | | |
159 | 218 | | |
160 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
161 | 226 | | |
162 | 227 | | |
163 | 228 | | |
| |||
382 | 447 | | |
383 | 448 | | |
384 | 449 | | |
385 | | - | |
386 | | - | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
387 | 458 | | |
388 | 459 | | |
389 | | - | |
| 460 | + | |
390 | 461 | | |
391 | 462 | | |
392 | 463 | | |
| |||
0 commit comments