Title: confusing results, the same usage memory in loops besides negative values · Issue #353 · pythonprofilers/memory_profiler · GitHub
Open Graph Title: confusing results, the same usage memory in loops besides negative values · Issue #353 · pythonprofilers/memory_profiler
X Title: confusing results, the same usage memory in loops besides negative values · Issue #353 · pythonprofilers/memory_profiler
Description: @fabianp How could I get true results or interpret them? memory-profiler shows same usage values for lines in the loop. import numpy as np from scipy.spatial import cKDTree, distance import os from memory_profiler import profile radii = ...
Open Graph Description: @fabianp How could I get true results or interpret them? memory-profiler shows same usage values for lines in the loop. import numpy as np from scipy.spatial import cKDTree, distance import os from...
X Description: @fabianp How could I get true results or interpret them? memory-profiler shows same usage values for lines in the loop. import numpy as np from scipy.spatial import cKDTree, distance import os from...
Opengraph URL: https://github.com/pythonprofilers/memory_profiler/issues/353
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"confusing results, the same usage memory in loops besides negative values","articleBody":"@fabianp How could I get true results or interpret them? `memory-profiler` shows same usage values for lines in the loop.\r\n```\r\nimport numpy as np\r\nfrom scipy.spatial import cKDTree, distance\r\nimport os\r\nfrom memory_profiler import profile\r\n\r\nradii = np.loadtxt(os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop', \"data\", 'radii.csv'))\r\nposs = np.loadtxt(os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop', \"data\", 'coordinates.csv'), delimiter=\",\")\r\nprint(len(radii))\r\nrad_max = np.amax(np.hstack(radii))\r\ndia_max = 2 * rad_max\r\n\r\n@profile\r\ndef ends_gap_opt(poss, dia_max):\r\n particle_corsp_overlaps = []\r\n ends_ind = [np.empty([1, 2], dtype=np.int64)]\r\n\r\n kdtree = cKDTree(poss)\r\n\r\n for particle_idx in range(len(poss)):\r\n cur_point = poss[particle_idx]\r\n nears_i_ind = np.array(kdtree.query_ball_point(cur_point, r=dia_max), dtype=np.int64)\r\n assert len(nears_i_ind) \u003e 0\r\n\r\n if len(nears_i_ind) \u003c= 1:\r\n continue\r\n\r\n nears_i_ind = nears_i_ind[nears_i_ind != particle_idx]\r\n dist_i = distance.cdist(poss[nears_i_ind], cur_point[None, :]).squeeze()\r\n\r\n contact_check = dist_i - (radii[nears_i_ind] + radii[particle_idx])\r\n connected = contact_check[contact_check \u003c= 0]\r\n\r\n particle_corsp_overlaps.append(connected)\r\n```\r\n\r\n[radii.csv](https://github.com/pythonprofilers/memory_profiler/files/8150100/radii.csv)\r\n[coordinates.csv](https://github.com/pythonprofilers/memory_profiler/files/8150101/coordinates.csv)\r\n\r\nI have modified the `memory_profiler.py` as pull requests [Fix: Large negative increments #350](https://github.com/pythonprofilers/memory_profiler/pull/350/commits/aa95e34cf6be3c51ba4aa3ccd014f6d40fc32392) and also, in another test using [large negative increment values in line profiler #195](https://github.com/pythonprofilers/memory_profiler/issues/195#issuecomment-401619708), . Both solutions remove previous negative values from *increments*. Which of them is the true one? \r\nThe same *mem usage*s are doubtful and seem to be wrong:\r\n\r\n","author":{"url":"https://github.com/alisheikholeslam","@type":"Person","name":"alisheikholeslam"},"datePublished":"2022-02-28T02:27:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/353/memory_profiler/issues/353"}
| 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:6691030e-9f55-e953-a9a6-ee50547e10ab |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A3CE:1FCEED:91C0C7:CCBB52:696F63E7 |
| html-safe-nonce | f0fe49e9ecd3f55e80f8c72426e631aae6bd7cf4706ef0ed16f0aaf45267d7c6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBM0NFOjFGQ0VFRDo5MUMwQzc6Q0NCQjUyOjY5NkY2M0U3IiwidmlzaXRvcl9pZCI6IjEyMDg5OTUxMjkyNTM4MTYwNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e91824f1551c99e060021f029a9b3bbedfabf32dd6b8ad7901423bb9f36846f9 |
| hovercard-subject-tag | issue:1153540908 |
| 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/pythonprofilers/memory_profiler/353/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a2230455b21351fcd481e4a1f34f6b6de111f904bbf508be7cb0cf26e153a217/pythonprofilers/memory_profiler/issues/353 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a2230455b21351fcd481e4a1f34f6b6de111f904bbf508be7cb0cf26e153a217/pythonprofilers/memory_profiler/issues/353 |
| og:image:alt | @fabianp How could I get true results or interpret them? memory-profiler shows same usage values for lines in the loop. import numpy as np from scipy.spatial import cKDTree, distance import os from... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | alisheikholeslam |
| hostname | github.com |
| expected-hostname | github.com |
| None | 774d0922d2c4577043d2dab90427344eb4c6ce1d5579acb1dd504cff1a7e46f8 |
| turbo-cache-control | no-preview |
| go-import | github.com/pythonprofilers/memory_profiler git https://github.com/pythonprofilers/memory_profiler.git |
| octolytics-dimension-user_id | 32906038 |
| octolytics-dimension-user_login | pythonprofilers |
| octolytics-dimension-repository_id | 2575826 |
| octolytics-dimension-repository_nwo | pythonprofilers/memory_profiler |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 2575826 |
| octolytics-dimension-repository_network_root_nwo | pythonprofilers/memory_profiler |
| 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 | 650acea592f12d1bd8931d44546c209e0b06ed6e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width