projects
/
software/dgc/naive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
1510e82
)
Initialize capacity to 0 when allocating a new cell
author
Alberto Bertogli
<albertito@blitiri.com.ar>
Fri, 15 May 2009 02:18:09 +0000 (23:18 -0300)
committer
Leandro Lucarella
<llucax@gmail.com>
Sun, 17 May 2009 21:04:02 +0000 (18:04 -0300)
Otherwise, when later we do cell.capacity == 0 we're using uninitialized
memory and can return the wrong result if we're not lucky enough to get 0s.
gc/gc.d
patch
|
blob
|
history
diff --git
a/gc/gc.d
b/gc/gc.d
index
3ee81ac
..
a7c8f59
100644
(file)
--- a/
gc/gc.d
+++ b/
gc/gc.d
@@
-533,6
+533,7
@@
public:
// No luck still, allocate new memory
cell = cast(Cell*) cstdlib.malloc(size + Cell.sizeof);
+ cell.capacity = 0; // so we can later tell it's new
if (cell)
goto success;