Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Symbols in AST with free-eable objects #345

Closed
daveraja opened this issue Nov 4, 2021 · 2 comments
Closed

Replace Symbols in AST with free-eable objects #345

daveraja opened this issue Nov 4, 2021 · 2 comments

Comments

@daveraja
Copy link

daveraja commented Nov 4, 2021

I would like to re-use clingo's parser as a fact parser in a process where the output won't necessary by passed directly to the solver. Unfortunate clingo's AST returns Symbol objects for its primitive data (string, constant, integer) and these objects currently cannot be freed ( issue #203 ).

So it might be a useful feature to separate the AST from the Symbol objects so that calling the parser only deals with free-able objects.

@rkaminsk
Copy link
Member

rkaminsk commented Nov 4, 2021

Since we have #203 it would, be better to address this issue. Right now clingo internalizes any string it sees regardless of whether it is used in a symbol or not (typically logic programs involve many occurring constants). This memory is never freed. Also note that numbers do not allocate extra memory. Unfortunately, addressing the issue is quite involved. This has to be well planned and involves touching almost every file in the clingo implementation.

Now, it would certainly be possible to address your issue but I'ld rather do this right rather than patching on a few ends.

@daveraja
Copy link
Author

daveraja commented Nov 4, 2021

Fair enough, I didn't have a sense of how difficult it would be. As you say better to address it once rather than in many places.

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

No branches or pull requests

2 participants