summaryrefslogtreecommitdiff
path: root/ast_to_hir.cpp
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2010-06-23 19:04:45 -0700
committerCarl Worth <cworth@cworth.org>2010-06-23 19:04:45 -0700
commitb3bd77da56ce8aa225ee91565e4d1e640685728c (patch)
tree2cb3bacc7f8d4b8df6c8b38ae5934ac9bd5f1c16 /ast_to_hir.cpp
parent12c411504ca86341f8b96c349c15413ee198cc71 (diff)
glsl_type: Add a talloc-based new
And hook it up at the two sites it's called. Note that with this change we still don't use glsl_type* objects as talloc contexts, (see things like get_array_instance that accept both a talloc 'ctx' as well as a glsl_type*). The reason for this is that the code is still using many instance of glsl_type objects not created with new. This closes 3 leaks in the glsl-orangebook-ch06-bump.frag test: total heap usage: 55,623 allocs, 55,618 Leaving only 5 leaks to go.
Diffstat (limited to 'ast_to_hir.cpp')
-rw-r--r--ast_to_hir.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp
index 38e344f0d2..ddd4b73266 100644
--- a/ast_to_hir.cpp
+++ b/ast_to_hir.cpp
@@ -2354,6 +2354,7 @@ ir_rvalue *
ast_struct_specifier::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
+ void *ctx = talloc_parent(state);
unsigned decl_count = 0;
/* Make an initial pass over the list of structure fields to determine how
@@ -2416,7 +2417,7 @@ ast_struct_specifier::hir(exec_list *instructions,
name = this->name;
}
- glsl_type *t = new glsl_type(fields, decl_count, name);
+ glsl_type *t = new(ctx) glsl_type(fields, decl_count, name);
YYLTYPE loc = this->get_location();
if (!state->symbols->add_type(name, t)) {