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

Do not close file after mmap #1017

Merged
merged 1 commit into from
Apr 16, 2023
Merged

Conversation

slaren
Copy link
Member

@slaren slaren commented Apr 16, 2023

Fixes #963

Copy link
Collaborator

@prusnak prusnak left a comment

Choose a reason for hiding this comment

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

There is no harm in not calling the close().

Since the underlying file is opened as read-only, the worst what can happen is that we will run out of file descriptors, which is hardly the case for llama.cpp.

Also, all file descriptors are closed by the kernel when the process exits.

@slaren
Copy link
Member Author

slaren commented Apr 16, 2023

The file should still be closed in the llama_file destructor, so I think this shouldn't cause any file descriptor leaks either.

@prusnak
Copy link
Collaborator

prusnak commented Apr 16, 2023

The file should still be closed in the llama_file destructor, so I think this shouldn't cause any file descriptor leaks either.

Right. I just confirmed that close() in ~llama_file() is called even when mmap() is used.

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.

Android port error
2 participants