-
-
Notifications
You must be signed in to change notification settings - Fork 139
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
Add option to limit the memory usage of Lua code #212
Merged
Merged
Changes from 42 commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
2669b63
add memory limit
Le0Developer b58a05e
add panic handler
Le0Developer bbfaf16
allow accessing and changing max memory
Le0Developer 3d5cd61
add docs
Le0Developer f574206
add LuaMemoryError
Le0Developer b125d1e
fix compiler warning
Le0Developer bb69bcc
use 0 to denote unlimited memory and always use our allocator
Le0Developer d607896
add tests
Le0Developer 22e4081
use python mem allocator and fix memory leak
Le0Developer b0306de
fix test by using a global so lua doesnt gc it
Le0Developer 4103220
revert to libc allocator
Le0Developer 158e922
remove memory_left property
Le0Developer 007a913
add nogil flag
Le0Developer 881d754
implement suggestions
Le0Developer ef0fb32
use lua allocator; add strict for set_max_memory; add docs
Le0Developer 6d3463f
add more tests
Le0Developer 5b4dc02
update docs
Le0Developer 46e3507
add memory_used
Le0Developer 68aad66
welp
Le0Developer d823152
update test
Le0Developer 00a81fe
revert this change
Le0Developer 9a8d5c1
Merge branch 'master' into feat/max-memory
scoder 3aa4d1d
Minor code cleanups.
scoder d907edf
Improve docstring.
scoder bde8543
Fix tests.
scoder 82502a6
ignore luajit
Le0Developer b1806fc
fix tests
Le0Developer a7386f3
catch more memory errors
Le0Developer 4143da5
inherit from MemoryError you shall
Le0Developer c43fbb9
fix python2.x compat & actually skip initializing lua
Le0Developer aedeb6e
add test for compile and fix memory error assert
Le0Developer 93f61be
possible fix for flaky test on win?
Le0Developer 6d874d5
this should be at the bottom, no?
Le0Developer 4b49057
Merge branch 'master' into feat/max-memory
scoder 7ac2d46
Clean up code and fix a couple of issues.
scoder b479160
Improve wording in changelog.
scoder 89540d0
Clarify and fix memory calculation logic in allocation function.
scoder 215a262
use struct
Le0Developer 86537ea
dont need these
Le0Developer 17e8c65
update set_max_memory docstring
Le0Developer 437c58d
use keyword arguments for better readability
Le0Developer 95eb2a5
add support for unlimited memory (0)
Le0Developer 4066683
Try to get by without dynamically allocating the memory state.
scoder f7659e4
count_base -> total
Le0Developer 4287c23
limit fixes
Le0Developer 5e2e673
attempt to document in readme
Le0Developer 48af7ac
Update README.rst
Le0Developer 0fc83c2
Update README.rst
Le0Developer 7b49c69
Move struct declaration before first usage
scoder 396e9dd
Update README.rst
Le0Developer 21f2945
fix issues
Le0Developer 40cf327
Update README.rst
Le0Developer 07a6b84
Remove unnecessary initialisations
scoder 8390d1f
Update README.rst
Le0Developer 5ae6a85
Ignore fully qualified exception name in doctest (Py2/3).
scoder 2b9cd96
size_t cannot be < 0
scoder 79608b8
Prevent usage of our special limit value -1.
scoder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary to allow
self._memory_status
to beNULL
?If not, you could simply use
cdef MemoryStatus _memory_status
as attribute instead of a pointer andcalloc
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I allowed it to be NULL for easier checking if the lua state is using our custom allocator.