-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Complete the use of the Lua state allocator.
The original work, in commit 4417618, failed to call the lua_Alloc function to free allocated memory. Thanks to George Zhao for the report (issue #3). Lrealloc and Lfree functions were added to mirror Lmalloc and simplify the code. In the process two other bugs turned up. First, one caller of Lmalloc tried to take action if the allocation failed, but this was ineffective, as Lmalloc called luaL_error. Hence, Lmalloc was changed not to abort on error. Secondly, in lgnu.c, Lmalloc was called erroneously, to allocate a buffer later freed by regfree (and hence by free); this was corrected to call malloc. The resulting code has been tested with both Lua 5.2 and luajit 2.0.0-beta9.
- Loading branch information
Showing
7 changed files
with
39 additions
and
20 deletions.
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
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
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