diff options
author | Carl Worth <cworth@cworth.org> | 2010-06-23 18:11:51 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2010-06-23 18:59:35 -0700 |
commit | 1660a2954797e056caba319c5d6c70b0d4be22fe (patch) | |
tree | 172af2dd8effb58c89828b917cae850058312edd /ir_dead_code.cpp | |
parent | 8f52c9b5fcbc73ed12b23253caa44c28fd4452e2 (diff) |
exec_node: Add new talloc-based new()
And fix all callers to use the tallbac-based new for exec_node
construction. We make ready use of talloc_parent in order to get
valid, (and appropriate) talloc owners for everything we construct
without having to add new 'ctx' parameters up and down all the call
trees.
This closes the majority of the memory leaks in the
glsl-orangebook-ch06-bump.frag test:
total heap usage: 55,623 allocs, 42,672 frees
(was 14,533 frees)
Now 76.7% leak-free. Woo-hoo!
Diffstat (limited to 'ir_dead_code.cpp')
-rw-r--r-- | ir_dead_code.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ir_dead_code.cpp b/ir_dead_code.cpp index 8465d863aa..01b7d2d832 100644 --- a/ir_dead_code.cpp +++ b/ir_dead_code.cpp @@ -77,6 +77,7 @@ public: variable_entry * ir_dead_code_visitor::get_variable_entry(ir_variable *var) { + void *ctx = talloc_parent(var); assert(var); foreach_iter(exec_list_iterator, iter, this->variable_list) { variable_entry *entry = (variable_entry *)iter.get(); @@ -84,7 +85,7 @@ ir_dead_code_visitor::get_variable_entry(ir_variable *var) return entry; } - variable_entry *entry = new variable_entry(var); + variable_entry *entry = new(ctx) variable_entry(var); this->variable_list.push_tail(entry); return entry; } |