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!
This commit is contained in:
+2
-1
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user