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_expression_flattening.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_expression_flattening.cpp')
-rw-r--r-- | ir_expression_flattening.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ir_expression_flattening.cpp b/ir_expression_flattening.cpp index 3089f17..5ba24e3 100644 --- a/ir_expression_flattening.cpp +++ b/ir_expression_flattening.cpp @@ -80,18 +80,19 @@ do_expression_flattening(exec_list *instructions, static ir_rvalue * operand_to_temp(ir_instruction *base_ir, ir_rvalue *ir) { + void *ctx = talloc_parent(base_ir); ir_variable *var; ir_assignment *assign; - var = new ir_variable(ir->type, "flattening_tmp"); + var = new(ctx) ir_variable(ir->type, "flattening_tmp"); base_ir->insert_before(var); - assign = new ir_assignment(new ir_dereference_variable(var), - ir, - NULL); + assign = new(ctx) ir_assignment(new(ctx) ir_dereference_variable(var), + ir, + NULL); base_ir->insert_before(assign); - return new ir_dereference_variable(var); + return new(ctx) ir_dereference_variable(var); } ir_visitor_status |