Just pre-allocate memory for the cached register value.
Shrinks heap overhead; increases locality-of-reference.
---
 src/target/armv4_5.c |    2 +-
 src/target/armv4_5.h |    1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

--- a/src/target/armv4_5.c
+++ b/src/target/armv4_5.c
@@ -489,7 +489,7 @@ struct reg_cache* armv4_5_build_reg_cach
 
                reg_list[i].name = (char *) arm_core_regs[i].name;
                reg_list[i].size = 32;
-               reg_list[i].value = calloc(1, 4);
+               reg_list[i].value = &arch_info[i].value;
                reg_list[i].type = &arm_reg_type;
                reg_list[i].arch_info = &arch_info[i];
 
--- a/src/target/armv4_5.h
+++ b/src/target/armv4_5.h
@@ -143,6 +143,7 @@ struct armv4_5_core_reg
        enum armv4_5_mode mode;
        struct target *target;
        struct arm *armv4_5_common;
+       uint32_t value;
 };
 
 struct reg_cache* armv4_5_build_reg_cache(struct target *target,
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to