Skip to content

Conversation

@marcoroth
Copy link
Owner

@marcoroth marcoroth commented Oct 19, 2025

Follow up on #690

bin/leaks_parse examples/incomplete_erb.invalid.html.erb

leaks Report Version: 4.0, multi-line stacks
Process 1007: 189 nodes malloced for 11 KB
Process 1007: 4 leaks for 240 total leaked bytes.

STACK OF 1 INSTANCE OF 'ROOT LEAK: <malloc in hb_array_init>':
5   dyld                                  0x1820aab98 start + 6076
4   herb                                  0x10282b800 main + 576  main.c:96
3   herb                                  0x102829250 herb_parse + 168  herb.c:40
2   herb                                  0x10282c29c herb_parser_init + 64  parser.c:39
1   herb                                  0x102831774 hb_array_init + 24  hb_array.c:12
0   libsystem_malloc.dylib                0x18227d080 _malloc_zone_malloc_instrumented_or_legacy + 152
====
    2 (176 bytes) ROOT LEAK: <malloc in hb_array_init 0x14c704130> [32]
       1 (144 bytes) <malloc in hb_array_init 0x14c704150> [144]

STACK OF 1 INSTANCE OF 'ROOT LEAK: <calloc in token_init>':
10  dyld                                  0x1820aab98 start + 6076
9   herb                                  0x10282b800 main + 576  main.c:96
8   herb                                  0x102829258 herb_parse + 176  herb.c:42
7   herb                                  0x10282c2e4 herb_parser_parse + 24  parser.c:1206
6   herb                                  0x10282c36c parser_parse_document + 124  parser.c:1196
5   herb                                  0x10282c054 parser_consume_expected + 36  parser_helpers.c:152
4   herb                                  0x10282c018 parser_consume_if_present + 64  parser_helpers.c:148
3   herb                                  0x10282bee8 parser_advance + 40  parser_helpers.c:142
2   herb                                  0x10282a3a4 lexer_next_token + 52  lexer.c:269
1   herb                                  0x10282fc5c token_init + 40  token.c:17
0   libsystem_malloc.dylib                0x18227d270 _malloc_zone_calloc_instrumented_or_legacy + 132
====
    2 (64 bytes) ROOT LEAK: <calloc in token_init 0x14c704370> [48]
       1 (16 bytes) <malloc in herb_strdup 0x14c7043a0> [16]

@marcoroth marcoroth force-pushed the herb-parse-memory-leak branch from 66a753f to 9a65536 Compare October 19, 2025 11:47
@marcoroth marcoroth force-pushed the herb-parse-memory-leak branch from 9a65536 to d489a02 Compare October 19, 2025 11:53
@marcoroth marcoroth merged commit 32139c2 into main Oct 19, 2025
19 checks passed
@marcoroth marcoroth deleted the herb-parse-memory-leak branch October 19, 2025 12:01
marcoroth pushed a commit that referenced this pull request Oct 19, 2025
This PR namespaces the `parser_free` function and renames it to
`parser_deinit`.

Follow up on #691
asilano pushed a commit to fac/herb that referenced this pull request Oct 21, 2025
Follow up on marcoroth#690 

**`bin/leaks_parse examples/incomplete_erb.invalid.html.erb`**

```
leaks Report Version: 4.0, multi-line stacks
Process 1007: 189 nodes malloced for 11 KB
Process 1007: 4 leaks for 240 total leaked bytes.

STACK OF 1 INSTANCE OF 'ROOT LEAK: <malloc in hb_array_init>':
5   dyld                                  0x1820aab98 start + 6076
4   herb                                  0x10282b800 main + 576  main.c:96
3   herb                                  0x102829250 herb_parse + 168  herb.c:40
2   herb                                  0x10282c29c herb_parser_init + 64  parser.c:39
1   herb                                  0x102831774 hb_array_init + 24  hb_array.c:12
0   libsystem_malloc.dylib                0x18227d080 _malloc_zone_malloc_instrumented_or_legacy + 152
====
    2 (176 bytes) ROOT LEAK: <malloc in hb_array_init 0x14c704130> [32]
       1 (144 bytes) <malloc in hb_array_init 0x14c704150> [144]

STACK OF 1 INSTANCE OF 'ROOT LEAK: <calloc in token_init>':
10  dyld                                  0x1820aab98 start + 6076
9   herb                                  0x10282b800 main + 576  main.c:96
8   herb                                  0x102829258 herb_parse + 176  herb.c:42
7   herb                                  0x10282c2e4 herb_parser_parse + 24  parser.c:1206
6   herb                                  0x10282c36c parser_parse_document + 124  parser.c:1196
5   herb                                  0x10282c054 parser_consume_expected + 36  parser_helpers.c:152
4   herb                                  0x10282c018 parser_consume_if_present + 64  parser_helpers.c:148
3   herb                                  0x10282bee8 parser_advance + 40  parser_helpers.c:142
2   herb                                  0x10282a3a4 lexer_next_token + 52  lexer.c:269
1   herb                                  0x10282fc5c token_init + 40  token.c:17
0   libsystem_malloc.dylib                0x18227d270 _malloc_zone_calloc_instrumented_or_legacy + 132
====
    2 (64 bytes) ROOT LEAK: <calloc in token_init 0x14c704370> [48]
       1 (16 bytes) <malloc in herb_strdup 0x14c7043a0> [16]

```
asilano pushed a commit to fac/herb that referenced this pull request Oct 21, 2025
This PR namespaces the `parser_free` function and renames it to
`parser_deinit`.

Follow up on marcoroth#691
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants