aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_db_hash.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2017-03-09 16:23:04 +0100
committerGuilherme Andrade <[email protected]>2017-03-22 23:57:55 +0000
commit5e18e917f29ed46caffa1211eb52ade01d24366a (patch)
treee38aba943e590b5b9f18173d79493d4b0c2a257b /erts/emulator/beam/erl_db_hash.c
parent865f06f93db7a68533bbdc4c961dd45699d6a07f (diff)
downloadotp-5e18e917f29ed46caffa1211eb52ade01d24366a.tar.gz
otp-5e18e917f29ed46caffa1211eb52ade01d24366a.tar.bz2
otp-5e18e917f29ed46caffa1211eb52ade01d24366a.zip
erts: Optimize ets:select_replace to not use heap
for temporary matchspec results. ToDo: Would be even nicer if PAM could allocate and build the ETS objects without extra copy_struct needed.
Diffstat (limited to 'erts/emulator/beam/erl_db_hash.c')
-rw-r--r--erts/emulator/beam/erl_db_hash.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_db_hash.c b/erts/emulator/beam/erl_db_hash.c
index 569419265b..92b833468d 100644
--- a/erts/emulator/beam/erl_db_hash.c
+++ b/erts/emulator/beam/erl_db_hash.c
@@ -2144,9 +2144,10 @@ static int mtraversal_select_replace_on_match_res(void* context_ptr, Sint slot_i
#endif
next = (**current_ptr_ptr)->next;
hval = (**current_ptr_ptr)->hvalue;
- new = replace_dbterm(tb, **current_ptr_ptr, match_res);
+ new = new_dbterm(tb, match_res);
new->next = next;
new->hvalue = hval;
+ free_term(tb, **current_ptr_ptr);
**current_ptr_ptr = new; /* replace 'next' pointer in previous object */
*current_ptr_ptr = &((**current_ptr_ptr)->next); /* advance to next object */
return 1;