Skip to content

Conversation

@marcoroth
Copy link
Owner

@marcoroth marcoroth commented Oct 20, 2025

❯ bin/leaks_parse examples/case_in.html.erb
herb(59888) MallocStackLogging: could not tag MSL-related memory as no_footprint, so those pages will be included in process footprint - (null)
herb(59888) MallocStackLogging: recording malloc (and VM allocation) stacks using lite mode
Process 59888 is not debuggable. Due to security restrictions, leaks can only show or save contents of readonly memory of restricted processes.

Process:         herb [59888]
Path:            /Users/USER/*/herb
Load Address:    0x100354000
Identifier:      herb
Version:         0
Code Type:       ARM64
Platform:        macOS
Parent Process:  leaks [59887]
Target Type:     live task

Date/Time:       2025-10-20 11:58:26.388 +0200
Launch Time:     2025-10-20 11:58:26.309 +0200
OS Version:      macOS 15.6.1 (24G90)
Report Version:  7
Analysis Tool:   /Applications/XCode.app/Contents/Developer/usr/bin/leaks
Analysis Tool Version:  Xcode 26.0.1 (17A400)

Physical footprint:         2704K
Physical footprint (peak):  2704K
Idle exit:                  untracked
----

leaks Report Version: 4.0, multi-line stacks
Process 59888: 261 nodes malloced for 18 KB
Process 59888: 76 leaks for 6880 total leaked bytes.

STACK OF 4 INSTANCES OF 'ROOT LEAK: <malloc in ast_erb_content_node_init>':
8   dyld                                  0x1820aab98 start + 6076
7   herb                                  0x10036393c main + 576  main.c:96
6   herb                                  0x100361258 herb_parse + 176  herb.c:42
5   herb                                  0x100364478 herb_parser_parse + 24  parser.c:1209
4   herb                                  0x1003644d4 parser_parse_document + 80  parser.c:1196
3   herb                                  0x10036461c parser_parse_in_data_state + 120  parser.c:1083
2   herb                                  0x100364a3c parser_parse_erb_tag + 148  parser.c:1002
1   herb                                  0x1003588b8 ast_erb_content_node_init + 60  ast_nodes.c:184
0   libsystem_malloc.dylib                0x18227d080 _malloc_zone_malloc_instrumented_or_legacy + 152
====
    72 (6.50K) << TOTAL >>
      ----
      19 (1.78K) ROOT LEAK: <malloc in ast_erb_content_node_init 0x152704400> [80]
         10 (1.39K) <malloc in init_analyzed_ruby 0x152704c20> [752]
            5 (384 bytes) <calloc in pm_parse 0x152704f10> [64]
               4 (320 bytes) <calloc in parse_statements 0x152704f50> [64]
                  3 (256 bytes) <malloc in pm_node_list_append 0x152704a40> [48]
                     2 (208 bytes) <calloc in pm_case_match_node_create 0x152704ff0> [112]
                        1 (96 bytes) <calloc in pm_hash_node_create 0x152704f90> [96]
            1 (112 bytes) <calloc in pm_constant_pool_init 0x152704150> [112]
            1 (64 bytes) <calloc in pm_diagnostic_list_append 0x152705060> [64]
            1 (64 bytes) <calloc in pm_diagnostic_list_append 0x1527050a0> [64]
            1 (48 bytes) <calloc in pm_newline_list_init 0x152704bc0> [48]
         2 (112 bytes) <malloc in hb_array_init 0x1527042c0> [32]
            1 (80 bytes) <malloc in hb_array_init 0x1527042e0> [80]
         2 (80 bytes) <calloc in token_copy 0x152704490> [48]
            1 (32 bytes) <malloc in herb_strdup 0x1527044c0> [32]
         2 (64 bytes) <calloc in token_copy 0x152704450> [48]
            1 (16 bytes) <malloc in herb_strdup 0x152704480> [16]
         2 (64 bytes) <calloc in token_copy 0x1527044e0> [48]
            1 (16 bytes) <malloc in herb_strdup 0x152704510> [16]
      ----
      19 (1.67K) ROOT LEAK: <malloc in ast_erb_content_node_init 0x152704630> [80]
         10 (1.30K) <malloc in init_analyzed_ruby 0x1527050e0> [752]
            5 (304 bytes) <calloc in pm_parse 0x152705470> [64]
               4 (240 bytes) <calloc in parse_statements 0x1527054b0> [64]
                  3 (176 bytes) <malloc in pm_node_list_append 0x152705560> [48]
                     1 (96 bytes) <calloc in pm_hash_node_create 0x152705590> [96]
                     1 (32 bytes) <calloc in pm_missing_node_create 0x1527041c0> [32]
            2 (112 bytes) <calloc in pm_diagnostic_list_append_format 0x1527054f0> [64]
               1 (48 bytes) <malloc in pm_diagnostic_list_append_format 0x152705530> [48]
            1 (112 bytes) <calloc in pm_constant_pool_init 0x1527053d0> [112]
            1 (48 bytes) <calloc in pm_newline_list_init 0x152705440> [48]
         2 (112 bytes) <malloc in hb_array_init 0x152704110> [32]
            1 (80 bytes) <malloc in hb_array_init 0x152704520> [80]
         2 (64 bytes) <calloc in token_copy 0x152704680> [48]
            1 (16 bytes) <malloc in herb_strdup 0x1527046b0> [16]
         2 (64 bytes) <calloc in token_copy 0x1527046c0> [48]
            1 (16 bytes) <malloc in herb_strdup 0x1527046f0> [16]
         2 (64 bytes) <calloc in token_copy 0x152704700> [48]
            1 (16 bytes) <malloc in herb_strdup 0x152704730> [16]
      ----
      18 (1.58K) ROOT LEAK: <malloc in ast_erb_content_node_init 0x152704880> [80]
         9 (1.20K) <malloc in init_analyzed_ruby 0x1527055f0> [752]
            4 (208 bytes) <calloc in pm_parse 0x152705980> [64]
               3 (144 bytes) <calloc in parse_statements 0x1527059c0> [64]
                  2 (80 bytes) <malloc in pm_node_list_append 0x152705a90> [48]
                     1 (32 bytes) <calloc in pm_missing_node_create 0x152705a70> [32]
            2 (112 bytes) <calloc in pm_diagnostic_list_append_format 0x152705a00> [64]
               1 (48 bytes) <malloc in pm_diagnostic_list_append_format 0x152705a40> [48]
            1 (112 bytes) <calloc in pm_constant_pool_init 0x1527058e0> [112]
            1 (48 bytes) <calloc in pm_newline_list_init 0x152705950> [48]
         2 (112 bytes) <malloc in hb_array_init 0x152704790> [32]
            1 (80 bytes) <malloc in hb_array_init 0x1527047d0> [80]
         2 (64 bytes) <calloc in token_copy 0x1527048d0> [48]
            1 (16 bytes) <malloc in herb_strdup 0x1527047c0> [16]
         2 (64 bytes) <calloc in token_copy 0x152704900> [48]
            1 (16 bytes) <malloc in herb_strdup 0x152704930> [16]
         2 (64 bytes) <calloc in token_copy 0x152704940> [48]
            1 (16 bytes) <malloc in herb_strdup 0x152704970> [16]
      ----
      16 (1.47K) ROOT LEAK: <malloc in ast_erb_content_node_init 0x152704ab0> [80]
         9 (1.20K) <malloc in init_analyzed_ruby 0x152705ac0> [752]
            4 (208 bytes) <calloc in pm_parse 0x152705e50> [64]
               3 (144 bytes) <calloc in parse_statements 0x152705e90> [64]
                  2 (80 bytes) <malloc in pm_node_list_append 0x152705f60> [48]
                     1 (32 bytes) <calloc in pm_missing_node_create 0x152705f40> [32]
            2 (112 bytes) <calloc in pm_diagnostic_list_append_format 0x152705ed0> [64]
               1 (48 bytes) <malloc in pm_diagnostic_list_append_format 0x152705f10> [48]
            1 (112 bytes) <calloc in pm_constant_pool_init 0x152705db0> [112]
            1 (48 bytes) <calloc in pm_newline_list_init 0x152705e20> [48]
         2 (64 bytes) <calloc in token_copy 0x152704b00> [48]
            1 (16 bytes) <malloc in herb_strdup 0x152704b30> [16]
         2 (64 bytes) <calloc in token_copy 0x152704b40> [48]
            1 (16 bytes) <malloc in herb_strdup 0x152704b70> [16]
         2 (64 bytes) <calloc in token_copy 0x152704b80> [48]
            1 (16 bytes) <malloc in herb_strdup 0x152704bb0> [16]

STACK OF 1 INSTANCE OF 'ROOT LEAK: <malloc in hb_array_init>':
8   dyld                                  0x1820aab98 start + 6076
7   herb                                  0x10036394c main + 592  main.c:100
6   herb                                  0x10035533c herb_analyze_parse_tree + 108  analyze.c:1067
5   herb                                  0x100368964 herb_visit_node + 40  visitor.c:12
4   herb                                  0x1003554fc transform_erb_nodes + 104  analyze.c:1027
3   herb                                  0x1003559e8 rewrite_node_array + 296  analyze.c:994
2   herb                                  0x100355d54 process_control_structure + 64  analyze.c:396
1   herb                                  0x100369a04 hb_array_init + 24  hb_array.c:12
0   libsystem_malloc.dylib                0x18227d080 _malloc_zone_malloc_instrumented_or_legacy + 152
====
    2 (112 bytes) ROOT LEAK: <malloc in hb_array_init 0x152706070> [32]
       1 (80 bytes) <malloc in hb_array_init 0x152706090> [80]

STACK OF 1 INSTANCE OF 'ROOT LEAK: <malloc in hb_array_init>':
8   dyld                                  0x1820aab98 start + 6076
7   herb                                  0x10036394c main + 592  main.c:100
6   herb                                  0x10035533c herb_analyze_parse_tree + 108  analyze.c:1067
5   herb                                  0x100368964 herb_visit_node + 40  visitor.c:12
4   herb                                  0x1003554fc transform_erb_nodes + 104  analyze.c:1027
3   herb                                  0x1003559e8 rewrite_node_array + 296  analyze.c:994
2   herb                                  0x100355d90 process_control_structure + 124  analyze.c:401
1   herb                                  0x100369a04 hb_array_init + 24  hb_array.c:12
0   libsystem_malloc.dylib                0x18227d080 _malloc_zone_malloc_instrumented_or_legacy + 152
====
    2 (112 bytes) ROOT LEAK: <malloc in hb_array_init 0x1527060e0> [32]
       1 (80 bytes) <malloc in hb_array_init 0x152706100> [80]
@marcoroth marcoroth force-pushed the analyze-memory-leaks branch 2 times, most recently from 126dbcf to 35c45bf Compare October 22, 2025 00:21
@marcoroth marcoroth marked this pull request as ready for review October 22, 2025 00:21
@marcoroth marcoroth force-pushed the analyze-memory-leaks branch from 35c45bf to f43a041 Compare October 22, 2025 00:32
@marcoroth marcoroth merged commit a24e98b into main Oct 22, 2025
20 checks passed
@marcoroth marcoroth deleted the analyze-memory-leaks branch October 22, 2025 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants