Thanks Drew, with these diffs, I should be able to track down the
location in the grammar where the memory allocation is an issue.

BTW, you can rebuild the parser (after making changes to the BisonGen
files - which will have portions of embedded C that are generated with
the final  SPARQLParser.c).  See the README.txt in trunk/src/bison:

--- from README.txt ----

This parser is implemented using the BisonGen format (see references
at bottom).  SPARQLParser.c is generated from all the
.bgen and .bgen.frag files.  The command-line invokation for doing this is:

BisonGen --mode=c SPARQL.bgen

NOTE: The latest version of BisonGen (from CVS) may be required
instead of the most package ftp://ftp.4suite.org/pub/BisonGen/

## Bison Gen Resources ##
- Copia article on BisonGen (with links):
http://copia.ogbuji.net/blog/2005-04-27/Of_BisonGe
- BisonGen CVS Tree:
cvs.4suite.org/viewcvs/BisonGen/[EMAIL 
PROTECTED]:~/devel/rdflib/trunk/src/bison$


On 8/21/06, Drew Perttula <[EMAIL PROTECTED]> wrote:
> I was getting occasional 'deallocating None' aborts when using the new C
> parser. The following patch seems to fix them, although I did not study
> the code enough to see which Py_None values were actually getting
> returned. Surely I am inflating the refcount on None, and I don't know
> if that will cause a problem or overflow.
>
> Anyway, here's the patch, made directly to the .c output since I didn't
> have a way to rebuild the parser:
>
> Index: src/bison/SPARQLParser.c
> ===================================================================
> --- src/bison/SPARQLParser.c    (revision 863)
> +++ src/bison/SPARQLParser.c    (working copy)
> @@ -1763,6 +1763,7 @@
>     /* from SPARQL.bgen, line 96
>      * Prolog:
>      */
> +  Py_INCREF(Py_None);
>     yyval = Py_None;
>     if (self->verbose) {
>       fprintf(stderr, "--Prolog(");
> @@ -1989,6 +1990,7 @@
>     /* from SPARQL.bgen, line 225
>      * VAR_REFERENCES: ASTERISK
>      */
> +  Py_INCREF(Py_None);
>     yyval = Py_None;
>     if (self->verbose) {
>       fprintf(stderr, "--VAR_REFERENCES(");
> @@ -4373,6 +4375,7 @@
>     /* from SPARQL.bgen, line 96
>      * Prolog:
>      */
> +  Py_INCREF(Py_None);
>     yyval = Py_None;
>     if (self->verbose) {
>       fprintf(stderr, "--Prolog(");
> @@ -4599,6 +4602,7 @@
>     /* from SPARQL.bgen, line 225
>      * VAR_REFERENCES: ASTERISK
>      */
> +  Py_INCREF(Py_None);
>     yyval = Py_None;
>     if (self->verbose) {
>       fprintf(stderr, "--VAR_REFERENCES(");
> @@ -6964,6 +6968,7 @@
>     /* from SPARQL.bgen, line 96
>      * Prolog:
>      */
> +  Py_INCREF(Py_None);
>     yyval = Py_None;
>     if (self->verbose) {
>       fprintf(stderr, "--Prolog(");
> @@ -7190,6 +7195,7 @@
>     /* from SPARQL.bgen, line 225
>      * VAR_REFERENCES: ASTERISK
>      */
> +  Py_INCREF(Py_None);
>     yyval = Py_None;
>     if (self->verbose) {
>       fprintf(stderr, "--VAR_REFERENCES(");
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://rdflib.net/mailman/listinfo/dev
>
_______________________________________________
Dev mailing list
[email protected]
http://rdflib.net/mailman/listinfo/dev

Reply via email to