{"action":"created","issue":{"url":"https://api.github.com/repos/Samsung/jerryscript/issues/683","labels_url":"https://api.github.com/repos/Samsung/jerryscript/issues/683/labels{/name}","comments_url":"https://api.github.com/repos/Samsung/jerryscript/issues/683/comments","events_url":"https://api.github.com/repos/Samsung/jerryscript/issues/683/events","html_url":"https://github.com/Samsung/jerryscript/issues/683","id":112797012,"number":683,"title":"mem_free_chunks_number is not zero on clean up after \"jerry_api_set_object_native_handle\" is called twice","user":{"login":"idkiller","id":891887,"avatar_url":"https://avatars.githubusercontent.com/u/891887?v=3","gravatar_id":"","url":"https://api.github.com/users/idkiller","html_url":"https://github.com/idkiller","followers_url":"https://api.github.com/users/idkiller/followers","following_url":"https://api.github.com/users/idkiller/following{/other_user}","gists_url":"https://api.github.com/users/idkiller/gists{/gist_id}","starred_url":"https://api.github.com/users/idkiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idkiller/subscriptions","organizations_url":"https://api.github.com/users/idkiller/orgs","repos_url":"https://api.github.com/users/idkiller/repos","events_url":"https://api.github.com/users/idkiller/events{/privacy}","received_events_url":"https://api.github.com/users/idkiller/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Samsung/jerryscript/labels/api","name":"api","color":"bfd4f2"},{"url":"https://api.github.com/repos/Samsung/jerryscript/labels/bug","name":"bug","color":"f7c6c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-22T12:57:48Z","updated_at":"2015-10-26T14:17:26Z","closed_at":null,"body":"`jerry_cleanup()` always make assert error after some object native handle were updated.\r\n\r\n```c++\r\n#include \"jerry.h\"\r\nconst char *jscode = \"foobar = {};\";\r\njerry_init(JERRY_FLAG_EMPTY);\r\njerry_parse (reinterpret_cast<const jerry_api_char_t*>(jscode), strlen (jscode));\r\njerry_run();\r\njerry_api_object_t *g = jerry_api_get_global();\r\njerry_api_value_t foobar;\r\njerry_api_get_object_field_value(g, reinterpret_cast<const jerry_api_char_t*>(\"foobar\"), &foobar);\r\njerry_api_set_object_native_handle(foobar.v_object, static_cast<uintptr_t>(0xabcdef), nullptr);\r\njerry_api_set_object_native_handle(foobar.v_object, static_cast<uintptr_t>(0x123456789), nullptr);\r\njerry_api_release_object(g);\r\njerry_api_release_value(&foobar);\r\njerry_cleanup();\r\n```\r\n\r\nthis code always failed.\r\n```\r\nICE: Assertion 'mem_free_chunks_number == 0' failed at jerryscript/jerry-core/mem/mem-poolman.cpp(mem_pools_finalize):183.\r\nError: ERR_FAILED_INTERNAL_ASSERTION\r\n\r\n```\r\n\r\nIs this bug? or intended design?\r\ncomment on function note shows that can be updated.\r\n```\r\nIf native handle was already set for the object, its value is updated.\r\n```"},"comment":{"url":"https://api.github.com/repos/Samsung/jerryscript/issues/comments/151149865","html_url":"https://github.com/Samsung/jerryscript/issues/683#issuecomment-151149865","issue_url":"https://api.github.com/repos/Samsung/jerryscript/issues/683","id":151149865,"user":{"login":"ruben-ayrapetyan","id":11939769,"avatar_url":"https://avatars.githubusercontent.com/u/11939769?v=3","gravatar_id":"","url":"https://api.github.com/users/ruben-ayrapetyan","html_url":"https://github.com/ruben-ayrapetyan","followers_url":"https://api.github.com/users/ruben-ayrapetyan/followers","following_url":"https://api.github.com/users/ruben-ayrapetyan/following{/other_user}","gists_url":"https://api.github.com/users/ruben-ayrapetyan/gists{/gist_id}","starred_url":"https://api.github.com/users/ruben-ayrapetyan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruben-ayrapetyan/subscriptions","organizations_url":"https://api.github.com/users/ruben-ayrapetyan/orgs","repos_url":"https://api.github.com/users/ruben-ayrapetyan/repos","events_url":"https://api.github.com/users/ruben-ayrapetyan/events{/privacy}","received_events_url":"https://api.github.com/users/ruben-ayrapetyan/received_events","type":"User","site_admin":false},"created_at":"2015-10-26T14:17:26Z","updated_at":"2015-10-26T14:17:26Z","body":"@idkiller, yes, seems that there is a bug: `ecma_create_external_pointer_property` should not reallocate \"external pointer\" (`ecma_external_pointer_t *handler_p = ecma_alloc_external_pointer ();`) if it was already allocated."}}