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:
Carl Worth
2010-06-23 18:11:51 -07:00
parent 8f52c9b5fc
commit 1660a29547
18 changed files with 351 additions and 235 deletions
+2 -1
View File
@@ -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;
}