Commit 8040f51
committed
unicodedata: allocate the per-call result strings through the managed path
`category`, `bidirectional`, `east_asian_width`, `decomposition`, `name`
and `lookup` build a fresh string on every call and returned it through
`w_str_new`, whose value buffer comes from `malloc_raw` -- a buffer the
collector can never reclaim. Scanning a text one character at a time
accumulated one such buffer per call. `w_str_new_managed` allocates a GC
storage box when the interpreter collector and the value tid are both
live, and falls back to immortal otherwise.
The remaining `w_str_new` calls in the module stay: `unidata_version`
and its siblings are module constants built once per process, and the
others are in tests.
Assisted-by: Claude1 parent 9a13788 commit 8040f51
1 file changed
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
| 117 | + | |
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
| 201 | + | |
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | | - | |
| 233 | + | |
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| |||
0 commit comments