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 /hir_field_selection.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 'hir_field_selection.cpp')
-rw-r--r-- | hir_field_selection.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/hir_field_selection.cpp b/hir_field_selection.cpp index e60ea30d7f..6da14925b9 100644 --- a/hir_field_selection.cpp +++ b/hir_field_selection.cpp @@ -33,6 +33,7 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr, exec_list *instructions, struct _mesa_glsl_parse_state *state) { + void *ctx = talloc_parent(state); ir_rvalue *result = NULL; ir_rvalue *op; @@ -62,8 +63,8 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr, expr->primary_expression.identifier); } } else if (op->type->base_type == GLSL_TYPE_STRUCT) { - result = new ir_dereference_record(op, - expr->primary_expression.identifier); + result = new(ctx) ir_dereference_record(op, + expr->primary_expression.identifier); if (result->type->is_error()) { _mesa_glsl_error(& loc, state, "Cannot access field `%s' of " |