[CWB] [cwb:bugs] #63 CQP parser memory leaks

Stefan Evert schtepf at users.sf.net
Sat Aug 19 10:41:08 CEST 2017




---

** [bugs:#63] CQP parser memory leaks**

**Status:** open
**Group:** TODO-3.5
**Created:** Sat Aug 19, 2017 08:41 AM UTC by Stefan Evert
**Last Updated:** Sat Aug 19, 2017 08:41 AM UTC
**Owner:** Stefan Evert


The CQP parser appears to be one big memory leak, because it allocates strings in the lexer and makes copies or allocates objects in grammar rules, which may not be deallocated at the end of a parse.

The grammar takes care to free allocated strings and other data (or embed them in larger data structures, passing on responsibility for the memory management). This works only for a successful parse, though: if bison aborts on a syntax error, intermediate results are discarded by the parser and the memory clean-up code is never reached.

The clean solution appears to be to add suitable %destructor directives for every symbol that contains allocated data, and to make sure that data are always copied when integrated into a larger data structure. It may also be necessary to add error recovery rules in order to ensure that the destructors are always invoked.

More information: https://www.gnu.org/software/bison/manual/html_node/Destructor-Decl.html


---

Sent from sourceforge.net because cwb at sslmit.unibo.it is subscribed to https://sourceforge.net/p/cwb/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/cwb/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://liste.sslmit.unibo.it/pipermail/cwb/attachments/20170819/1fe79c88/attachment-0001.html>


More information about the CWB mailing list