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

Andrew Hardie andrewhardie at users.sourceforge.net
Wed Mar 31 06:21:53 CEST 2021


- **status**: open --> closed-wont-fix
- **Comment**:

Executive decision (valid until  SE overrules me): Any consequential individual leaks can be fixed with ad hoc hackery in 3.5.>=1  ;  others are clearly liveable with ; the general issue will be fixed by the changed mechanisms in 3.9 / 4.0 ; bug closed.



---

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

**Status:** closed-wont-fix
**Group:** TODO-3.5
**Created:** Sat Aug 19, 2017 08:41 AM UTC by Stefan Evert
**Last Updated:** Sat Aug 19, 2017 08:42 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/20210331/51cee973/attachment.html>


More information about the CWB mailing list