Title: Memory leak when dealing with images. iOS · Issue #3887 · NativeScript/NativeScript · GitHub
Open Graph Title: Memory leak when dealing with images. iOS · Issue #3887 · NativeScript/NativeScript
X Title: Memory leak when dealing with images. iOS · Issue #3887 · NativeScript/NativeScript
Description: I display two images on the page. When either is tapped, two new images are loaded. I've tried binding the src properties to an observable and updating this. I've also tried removing the Image elements and entirely replacing them. Both o...
Open Graph Description: I display two images on the page. When either is tapped, two new images are loaded. I've tried binding the src properties to an observable and updating this. I've also tried removing the Image elem...
X Description: I display two images on the page. When either is tapped, two new images are loaded. I've tried binding the src properties to an observable and updating this. I've also tried removing the Im...
Opengraph URL: https://github.com/NativeScript/NativeScript/issues/3887
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Memory leak when dealing with images. iOS","articleBody":"I display two images on the page. When either is tapped, two new images are loaded. I've tried binding the `src` properties to an observable and updating this. I've also tried removing the `Image` elements and entirely replacing them. Both of these lead to high memory usage and crashes. It looks like the old images are never removed from memory.\r\n\r\nHere is part of the code using binding. Memory usage jumps by ~30mb each time these images are loaded - even though the images themselves are only 87kb. \r\n\r\n```\r\nfunction loadQuestionImages(question) {\r\n // ## Load both images before binding to ensure\r\n // ## both display at same time.\r\n\r\n var loadedImages = 0;\r\n var imageSRC_1;\r\n var imageSRC_2;\r\n\r\n imageSourceModule.fromUrl('https://placehold.it/2000x2000')\r\n .then(function (res) {\r\n loadedImages = loadedImages + 1;\r\n imageSRC_1 = res;\r\n\r\n if (loadedImages == 2) {\r\n imagesLoaded();\r\n }\r\n }, function (error) {\r\n //console.log(\"Error loading image: \" + error);\r\n });\r\n\r\n imageSourceModule.fromUrl('https://placehold.it/2000x2000')\r\n .then(function (res) {\r\n loadedImages = loadedImages + 1;\r\n imageSRC_2 = res;\r\n\r\n if (loadedImages == 2) {\r\n imagesLoaded();\r\n }\r\n }, function (error) {\r\n //console.log(\"Error loading image: \" + error);\r\n });\r\n\r\n function imagesLoaded() {\r\n pageData.set('imageSRC_1', imageSRC_1);\r\n pageData.set('imageSRC_2', imageSRC_2);\r\n\r\n animateInImages();\r\n }\r\n}\r\n```\r\n\r\nThere is also a project here that replaces the image elements https://github.com/3rror404/ImageMemoryTest. This performs exactly the same as the code above.\r\n\r\nAm I doing something wrong here? \r\n\r\nThanks","author":{"url":"https://github.com/3rror404","@type":"Person","name":"3rror404"},"datePublished":"2017-03-28T11:19:37Z","url":"https://github.com/NativeScript/NativeScript/issues/3887"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ef4656d6-2f3e-c505-2c60-64cac9f18641 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 812C:26ECEB:1E6ED8A:26B809D:6B014FEA |
| html-safe-nonce | dc79aa542265d19ed76941a4ff46079f66dcc4c17b157ef45bbd67b8e53662c9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MTJDOjI2RUNFQjoxRTZFRDhBOjI2QjgwOUQ6NkIwMTRGRUEiLCJ2aXNpdG9yX2lkIjoiMTUwODY3NjM5MjAxMzg3NzIyNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b6105e30c99d0b04718aee65cb5f3934bb8c396a801901d602a9eea6ef13c4f9 |
| hovercard-subject-tag | issue:217526824 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/NativeScript/3887/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d4a68f081a57113c5272f9a89cad735069b141e9468c760910bdec23d6142fd0/NativeScript/NativeScript/issues/3887 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d4a68f081a57113c5272f9a89cad735069b141e9468c760910bdec23d6142fd0/NativeScript/NativeScript/issues/3887 |
| og:image:alt | I display two images on the page. When either is tapped, two new images are loaded. I've tried binding the src properties to an observable and updating this. I've also tried removing the Image elem... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | 3rror404 |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/NativeScript/NativeScript git https://github.com/NativeScript/NativeScript.git |
| octolytics-dimension-user_id | 7392261 |
| octolytics-dimension-user_login | NativeScript |
| octolytics-dimension-repository_id | 31492490 |
| octolytics-dimension-repository_nwo | NativeScript/NativeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31492490 |
| octolytics-dimension-repository_network_root_nwo | NativeScript/NativeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width