Skip to content

Conversation

iliabylich
Copy link
Contributor

Like I mentioned in a previous PR it's error-prone.

@kddnewton WDYT about marking them as generated somehow? In lib-ruby_parser I added a suffix _gen to such files together with a comment at the top of the file // This file has been generated based on <template path>

@kddnewton
Copy link
Collaborator

Yeah I think a suffix and a comment is good. In general I'm a big fan of a ton of comments.

@kddnewton kddnewton merged commit 05a5b96 into main Sep 23, 2022
@kddnewton kddnewton deleted the extract-location-and-node branch September 23, 2022 14:55
peterzhu2118 added a commit that referenced this pull request Oct 5, 2025
We need to free the current_block_exits in parse_program when we're done
with it to prevent memory leaks. This fixes the following memory leak detected
when running Ruby using `RUBY_FREE_AT_EXIT=1 ruby -nc -e "break"`:

    Direct leak of 32 byte(s) in 1 object(s) allocated from:
        #0 0x5bd3c5bc66c8 in realloc (miniruby+0x616c8) (BuildId: ba6a96e5a060aec6fd9f05ed7e95d9627e1dbd74)
        #1 0x5bd3c5f91fd9 in pm_node_list_grow prism/templates/src/node.c.erb:35:40
        #2 0x5bd3c5f91e9d in pm_node_list_append prism/templates/src/node.c.erb:48:9
        #3 0x5bd3c6001fa0 in parse_block_exit prism/prism.c:15788:17
        #4 0x5bd3c5fee155 in parse_expression_prefix prism/prism.c:19221:50
        #5 0x5bd3c5fe9970 in parse_expression prism/prism.c:22235:23
        #6 0x5bd3c5fe0586 in parse_statements prism/prism.c:13976:27
        #7 0x5bd3c5fd6792 in parse_program prism/prism.c:22508:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants