diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-03-20 09:49:30 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-03-20 09:49:30 -0300 |
commit | 2c8206d448fe05b94d3841e9e2472e78e6aadc13 (patch) | |
tree | 4cfa50071167ee657124531b4ba11660b3da2dc1 | |
parent | ae76307847efa83df131fd9ad3180982131b8c72 (diff) | |
download | lua-2c8206d448fe05b94d3841e9e2472e78e6aadc13.tar.gz lua-2c8206d448fe05b94d3841e9e2472e78e6aadc13.tar.bz2 lua-2c8206d448fe05b94d3841e9e2472e78e6aadc13.zip |
bug in Lua 4.0.2: weak tables that survive one collection are never collected
-rw-r--r-- | bugs | 37 |
1 files changed, 35 insertions, 2 deletions
@@ -1,4 +1,4 @@ | |||
1 | --[[ | 1 | --[=[ |
2 | ** lua.stx / llex.c | 2 | ** lua.stx / llex.c |
3 | Tue Dec 2 10:45:48 EDT 1997 | 3 | Tue Dec 2 10:45:48 EDT 1997 |
4 | >> BUG: "lastline" was not reset on function entry, so debug information | 4 | >> BUG: "lastline" was not reset on function entry, so debug information |
@@ -336,7 +336,7 @@ Thu Mar 20 11:40:12 EST 2003 | |||
336 | 336 | ||
337 | 337 | ||
338 | 338 | ||
339 | --]] | 339 | --]=] |
340 | ----------------------------------------------------------------- | 340 | ----------------------------------------------------------------- |
341 | -- Lua 5.0 (final) | 341 | -- Lua 5.0 (final) |
342 | 342 | ||
@@ -764,3 +764,36 @@ patch = [[ | |||
764 | ]], | 764 | ]], |
765 | } | 765 | } |
766 | 766 | ||
767 | |||
768 | Bug{ | ||
769 | what = [[weak tables that survive one collection are never collected]], | ||
770 | |||
771 | report = [[Chromix, 02/01/2006]], | ||
772 | |||
773 | example = [[ | ||
774 | a = {} | ||
775 | print(gcinfo()) | ||
776 | for i = 1, 10000 do | ||
777 | a[i] = setmetatable({}, {__mode = "v"}) | ||
778 | end | ||
779 | collectgarbage() | ||
780 | a = nil | ||
781 | collectgarbage() | ||
782 | print(gcinfo()) | ||
783 | ]], | ||
784 | |||
785 | patch = [[ | ||
786 | * lgc.c | ||
787 | @@ -366,7 +366,7 @@ | ||
788 | GCObject *curr; | ||
789 | int count = 0; /* number of collected items */ | ||
790 | while ((curr = *p) != NULL) { | ||
791 | - if (curr->gch.marked > limit) { | ||
792 | + if ((curr->gch.marked & ~(KEYWEAK | VALUEWEAK)) > limit) { | ||
793 | unmark(curr); | ||
794 | p = &curr->gch.next; | ||
795 | } | ||
796 | ]], | ||
797 | |||
798 | } | ||
799 | |||