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

Solution to Memory leaks by interning external strings #24 per @sletner #234

Closed
wants to merge 2 commits into from

Conversation

daninus14
Copy link

No description provided.

@daninus14
Copy link
Author

This addresses this issue: #24

Copy link
Member

@hanshuebner hanshuebner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized that you're monkey-patching CHUNGA, which I'm not a fan of. I think it would be preferable to fix the issue there.

headers.lisp Outdated

(in-package :chunga)

(defvar *intern-unsafely*)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initialize this with nil to simplify the check in as-keyword.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just added it

headers.lisp Outdated

(defun as-keyword (string &key (destructivep t))
"Checks if the string STRING is found as a keyword and if it is, returns the keyword, otherwise it returns a string. Note that this is obviously not congruent to the name of the function, it is meant to be an override to the default behavior to avoid memory leaks in Hunchentoot"
(or (gethash string +string-to-keyword-hash+)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not go through +string-to-keyword-hash+ and instead invoke find-symbol directly.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just added it

@daninus14
Copy link
Author

I just realized that you're monkey-patching CHUNGA, which I'm not a fan of. I think it would be preferable to fix the issue there.

So should I make this changes in chunga instead and open a PR there?

@hanshuebner
Copy link
Member

I just realized that you're monkey-patching CHUNGA, which I'm not a fan of. I think it would be preferable to fix the issue there.

So should I make this changes in chunga instead and open a PR there?

Yes please!

@daninus14
Copy link
Author

I just realized that you're monkey-patching CHUNGA, which I'm not a fan of. I think it would be preferable to fix the issue there.

So should I make this changes in chunga instead and open a PR there?

Yes please!

Ok, so I made a PR there, will make changes here to account for that as well

@daninus14
Copy link
Author

Ok, made the PR over there, please take a look at the code since I am implementing it differently than here since it's all internal to chunga and there's no need for the *intern-unsafely*

@daninus14 daninus14 closed this Sep 18, 2024
@hanshuebner
Copy link
Member

The CHUNGA PR is merged, thank you!

@daninus14
Copy link
Author

Thank you as well for the guidance and being so responsive!

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

Successfully merging this pull request may close these issues.

2 participants