diff options
author | Kenneth Graunke <[email protected]> | 2011-09-22 13:05:03 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2011-09-23 17:12:47 -0700 |
commit | 0d949a51bb44da51cd843abcf6ecddc5e3d3a2f1 (patch) | |
tree | d04a4590b8158d6014c362faca88daea26ecf6d4 | |
parent | 0fabf8e8dc96a0eb8a9fbbac760d4faceee3af48 (diff) |
glsl: Free all S-Expressions immediately after reading IR.
For some reason I thought subexpressions were chained off the top-level
one. This isn't the case, so just create a temporary context and free
it. All of this memory would be eventually freed, but now is freed
much sooner.
Signed-off-by: Kenneth Graunke <[email protected]>
-rw-r--r-- | src/glsl/ir_reader.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index 2d0bccb78cd..afb06b3beff 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -79,7 +79,8 @@ _mesa_glsl_read_ir(_mesa_glsl_parse_state *state, exec_list *instructions, void ir_reader::read(exec_list *instructions, const char *src, bool scan_for_protos) { - s_expression *expr = s_expression::read_expression(mem_ctx, src); + void *sx_mem_ctx = ralloc_context(NULL); + s_expression *expr = s_expression::read_expression(sx_mem_ctx, src); if (expr == NULL) { ir_read_error(NULL, "couldn't parse S-Expression."); return; @@ -92,7 +93,7 @@ ir_reader::read(exec_list *instructions, const char *src, bool scan_for_protos) } read_instructions(instructions, expr, NULL); - ralloc_free(expr); + ralloc_free(sx_mem_ctx); if (debug) validate_ir_tree(instructions); |