Move large structure off the stack.
am: 50270d3ef2
Change-Id: Ic8b2336685c848287defe0826b73875f849ba2a5
diff --git a/src/os-linux.c b/src/os-linux.c
index 7062a1b..8dc1ebf 100644
--- a/src/os-linux.c
+++ b/src/os-linux.c
@@ -40,7 +40,7 @@
struct map_info *map_list = NULL;
struct map_info *cur_map;
unw_addr_space_t as = NULL;
- struct unw_addr_space local_as;
+ struct unw_addr_space* local_as = NULL;
void* as_arg = NULL;
if (maps_init (&mi, pid) < 0)
@@ -100,8 +100,14 @@
{
if (map_create_type == UNW_MAP_CREATE_LOCAL)
{
- as = &local_as;
- unw_local_access_addr_space_init (as);
+ // This is a very large structure, so allocate it.
+ if (local_as == NULL)
+ local_as = (struct unw_addr_space*) malloc(sizeof(*local_as));
+ if (local_as != NULL)
+ {
+ as = local_as;
+ unw_local_access_addr_space_init (as);
+ }
}
else
{
@@ -147,6 +153,8 @@
_UPT_destroy (as_arg);
}
+ free(local_as);
+
return map_list;
}
/* End of ANDROID update. */