From: Shinwoo Kim Date: Thu, 21 Feb 2019 23:13:42 +0000 (+0900) Subject: Revert "eet: add counter for number of frees needed in each directory" X-Git-Tag: submit/tizen/20190222.044455^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2e6b1614ef079fc01a4513660984120af3b8e3b7;p=platform%2Fupstream%2Fefl.git Revert "eet: add counter for number of frees needed in each directory" This reverts commit 83be62392df0392be435b6d3c52db6d59b7efda6. To solve heap memory usage problem. Please refer to following massif result. n1: 236176 0x541A92C: edje_mmap_data_get (in /usr/lib/libedje.so.1.21.99) n1: 236176 0x4A5C038: _elm_theme_file_item_add (elm_theme.c:63) n1: 236176 0x4A5C886: _elm_theme_parse (elm_theme.c:485) n1: 236176 0x4981160: _config_apply (elm_config.c:1686) n1: 236176 0x498DFDE: _elm_config_init (elm_config.c:4755) n1: 236176 0x4A0E05A: elm_quicklaunch_sub_init (elm_main.c:867) n1: 58267 0x541A92C: edje_mmap_data_get (in /usr/lib/libedje.so.1.21.99) n1: 58267 0x4A5C038: _elm_theme_file_item_add (elm_theme.c:63) n1: 58267 0x4A5C886: _elm_theme_parse (elm_theme.c:485) n1: 58267 0x4981160: _config_apply (elm_config.c:1686) n1: 58267 0x498DFDE: _elm_config_init (elm_config.c:4755) n1: 58267 0x4A0E05A: elm_quicklaunch_sub_init (elm_main.c:867) Change-Id: Ib3c1fd58c5e038da2059855ba644309e9bafb04e --- diff --git a/src/lib/eet/Eet_private.h b/src/lib/eet/Eet_private.h index becfabb..2f539ed 100644 --- a/src/lib/eet/Eet_private.h +++ b/src/lib/eet/Eet_private.h @@ -110,7 +110,6 @@ struct _Eet_File_Directory { int size; Eet_File_Node **nodes; - unsigned int free_count; }; struct _Eet_File_Node diff --git a/src/lib/eet/eet_lib.c b/src/lib/eet/eet_lib.c index 0e05b2a..3b9b7d9 100644 --- a/src/lib/eet/eet_lib.c +++ b/src/lib/eet/eet_lib.c @@ -873,10 +873,7 @@ eet_internal_read2(Eet_File *ef) { efn->data = malloc(efn->size); if (efn->data) - { - memcpy(efn->data, ef->data + efn->offset, efn->size); - ef->header->directory->free_count++; - } + memcpy(efn->data, ef->data + efn->offset, efn->size); } /* compute the possible position of a signature */ @@ -1180,7 +1177,6 @@ eet_internal_read1(Eet_File *ef) strncpy(efn->name, (char *)p + HEADER_SIZE, name_size); efn->name[name_size] = 0; - ef->header->directory->free_count++; WRN( "File: %s is not up to date for key \"%s\" - needs rebuilding sometime", @@ -1203,10 +1199,7 @@ eet_internal_read1(Eet_File *ef) { data = malloc(efn->size); if (data) - { - memcpy(data, ef->data + efn->offset, efn->size); - ef->header->directory->free_count++; - } + memcpy(data, ef->data + efn->offset, efn->size); efn->data = data; } @@ -1315,31 +1308,21 @@ eet_internal_close(Eet_File *ef, int i, num; num = (1 << ef->header->directory->size); - for (i = 0; i < num && ef->header->directory->free_count; i++) + for (i = 0; i < num; i++) { Eet_File_Node *efn; while ((efn = ef->header->directory->nodes[i])) { if (efn->data) - { - free(efn->data); - ef->header->directory->free_count--; - } + free(efn->data); ef->header->directory->nodes[i] = efn->next; if (efn->free_name) - { - free(efn->name); - ef->header->directory->free_count--; - } - - if (shutdown) - { - if (!ef->header->directory->free_count) break; - } - else + free(efn->name); + + if (!shutdown) eet_file_node_mp_free(efn); } } @@ -2315,14 +2298,12 @@ eet_alias(Eet_File *ef, efn->name = strdup(name); efn->name_size = strlen(efn->name) + 1; efn->free_name = 1; - ef->header->directory->free_count++; efn->data = NULL; efn->next = ef->header->directory->nodes[hash]; ef->header->directory->nodes[hash] = efn; eet_define_data(ef, efn, in, strlen(destination) + 1, comp, 0); - ef->header->directory->free_count++; } efn->alias = 1; @@ -2465,14 +2446,12 @@ eet_write_cipher(Eet_File *ef, efn->name = strdup(name); efn->name_size = strlen(efn->name) + 1; efn->free_name = 1; - ef->header->directory->free_count++; efn->data = NULL; efn->next = ef->header->directory->nodes[hash]; ef->header->directory->nodes[hash] = efn; eet_define_data(ef, efn, in, size, comp, !!cipher_key); - ef->header->directory->free_count++; } /* flags that writes are pending */