<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi!<br>
<br>
Definitely a bug. You should definitely be able to catch an
exception here without leaking memory! <br>
<br>
Could you submit a patch as you suggested, or should i put it in
the backlog for "future processing" by us?<br>
<br>
Cheers,<br>
Patrik<br>
On 06/06/2013 01:48 PM, Erik Søe Sørensen wrote:<br>
</div>
<blockquote cite="mid:51B0770E.7060009@trifork.com" type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
Hi there -<br>
When parsing a string, xmerl_scan creates an ets table which it
doesn't delete again in the case of exceptions.<br>
<br>
Demo:<br>
<blockquote>Erlang R16B (erts-5.10.1) [source] [64-bit] [smp:8:8]
[async-threads:10] [hipe] [kernel-poll:false]<br>
<br>
Eshell V5.10.1 (abort with ^G)<br>
1> length(ets:all()). <br>
16<br>
2> <br>
2> catch xmerl_scan:string("").<br>
3900- fatal: expected_element_start_tag<br>
{'EXIT',<br>
{fatal,<br>
{expected_element_start_tag,<br>
{file,file_name_unknown},<br>
{line,1},<br>
{col,1}}}}<br>
3> length(ets:all()). <br>
17<br>
</blockquote>
(I just re-discovered this bug; I apologize for having neglected
to report it earlier, considering that I've noticed it before some
years ago.)<br>
<br>
From a brief inspection at the code, I think the place to ensure
table deletion would be to add a "try...after" in scan_document.
Alternatively, it could be done in int_string/4 and
int_string_decl/4, where the cleanup can mirror the calls to
initial_state0()->initial_state() where the ets table is
created.<br>
<br>
Regards,<br>
Erik Søe Sørensen<br>
<br>
<div class="moz-signature">-- <br>
<div style="color: black; text-align: center;"> <span>Mobile: +
45 26 36 17 55</span> <span> </span> <span style="color:
black; ">| Skype: eriksoesorensen</span> <span> </span> <span
style="color: black; ">| Twitter: @eriksoe</span> </div>
<div style="text-align: center; color: gray;"> <span>Trifork
A/S | Margrethepladsen 4 | DK-8000 Aarhus C | </span> <a
moz-do-not-send="true" href="http://www.trifork.com/"><span
style="text-decoration: underline; color: gray;">www.trifork.com</span></a>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
erlang-bugs mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-bugs@erlang.org">erlang-bugs@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-bugs">http://erlang.org/mailman/listinfo/erlang-bugs</a>
</pre>
</blockquote>
<br>
</body>
</html>