Melbourne leaks memory when raising a SyntaxError #249

Closed
evanphx opened this Issue Apr 3, 2010 · 3 comments

Comments

Projects
None yet
3 participants
@evanphx
Member

evanphx commented Apr 3, 2010

At present, when melbourne raise a syntax error, it has partially constructed a NODE* tree. The memory for this tree is managed by pt_allocate, which uses a simple memory pool mechanism to free the entire tree at the same time. This happens fine.

The problem is that the tree contains bstring's which need to have bdestroy() run on them or they leak memory. At present, bdestroy() is run when we run the visitors on the tree. But if a syntax error is cut, the tree is not processed and the bstring's are leak.

Possible solutions are to not use bstring at all within NODE* and instead build a simple string library that uses pt_allocate for allocations.

@wycats

This comment has been minimized.

Show comment Hide comment
@wycats

wycats Apr 3, 2010

Member

Some of us in the office think you should leave this leak as punishment to people who have syntax errors in their code.

Member

wycats commented Apr 3, 2010

Some of us in the office think you should leave this leak as punishment to people who have syntax errors in their code.

@rkh

This comment has been minimized.

Show comment Hide comment
@rkh

rkh Apr 16, 2010

Member

Don't you have to, like, rescue the SyntaxError for this to matter? Won't that happen only in irb?

Member

rkh commented Apr 16, 2010

Don't you have to, like, rescue the SyntaxError for this to matter? Won't that happen only in irb?

@evanphx

This comment has been minimized.

Show comment Hide comment
@evanphx

evanphx May 5, 2010

Member

Fixing post 1.0

Member

evanphx commented May 5, 2010

Fixing post 1.0

This issue was closed.

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