aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_load.c
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2011-09-29 18:02:47 +0200
committerLukas Larsson <[email protected]>2011-09-29 18:02:47 +0200
commit09c46998b3a4b0060b3ff3799c142d564f91f517 (patch)
tree8f2f5f53b4efc4a0b19c3b668485f679a09f7e65 /erts/emulator/beam/beam_load.c
parent71099221fc8d0456fb38b1954e9053ec527d43b2 (diff)
parentbeaa58d5724c4ae45a716accdeee58961a27e1d9 (diff)
downloadotp-09c46998b3a4b0060b3ff3799c142d564f91f517.tar.gz
otp-09c46998b3a4b0060b3ff3799c142d564f91f517.tar.bz2
otp-09c46998b3a4b0060b3ff3799c142d564f91f517.zip
Merge branch 'dev' into major
* dev: Prevent valgrind warning for erts_alloc_permanent_cache_aligned [erts] Fix memory leak in erts_make_stub_module (hipe loading)
Diffstat (limited to 'erts/emulator/beam/beam_load.c')
-rw-r--r--erts/emulator/beam/beam_load.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c
index fad81e24d6..16dd5795c7 100644
--- a/erts/emulator/beam/beam_load.c
+++ b/erts/emulator/beam/beam_load.c
@@ -683,6 +683,25 @@ bin_load(Process *c_p, ErtsProcLocks c_p_locks,
}
/*
+ * Initialize code area.
+ */
+ state.code_buffer_size = erts_next_heap_size(2048 + state.num_functions, 0);
+ state.code = (BeamInstr *) erts_alloc(ERTS_ALC_T_CODE,
+ sizeof(BeamInstr) * state.code_buffer_size);
+
+ state.code[MI_NUM_FUNCTIONS] = state.num_functions;
+ state.ci = MI_FUNCTIONS + state.num_functions + 1;
+
+ state.code[MI_ATTR_PTR] = 0;
+ state.code[MI_ATTR_SIZE] = 0;
+ state.code[MI_ATTR_SIZE_ON_HEAP] = 0;
+ state.code[MI_COMPILE_PTR] = 0;
+ state.code[MI_COMPILE_SIZE] = 0;
+ state.code[MI_COMPILE_SIZE_ON_HEAP] = 0;
+ state.code[MI_NUM_BREAKPOINTS] = 0;
+
+
+ /*
* Read the atom table.
*/
@@ -1575,24 +1594,6 @@ read_code_header(LoaderState* stp)
#endif
}
- /*
- * Initialize code area.
- */
- stp->code_buffer_size = erts_next_heap_size(2048 + stp->num_functions, 0);
- stp->code = (BeamInstr *) erts_alloc(ERTS_ALC_T_CODE,
- sizeof(BeamInstr) * stp->code_buffer_size);
-
- stp->code[MI_NUM_FUNCTIONS] = stp->num_functions;
- stp->ci = MI_FUNCTIONS + stp->num_functions + 1;
-
- stp->code[MI_ATTR_PTR] = 0;
- stp->code[MI_ATTR_SIZE] = 0;
- stp->code[MI_ATTR_SIZE_ON_HEAP] = 0;
- stp->code[MI_COMPILE_PTR] = 0;
- stp->code[MI_COMPILE_SIZE] = 0;
- stp->code[MI_COMPILE_SIZE_ON_HEAP] = 0;
- stp->code[MI_NUM_BREAKPOINTS] = 0;
-
stp->new_bs_put_strings = 0;
stp->catches = 0;
return 1;