Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug memory leak in wave #845

Closed
wants to merge 1 commit into from
Closed

debug memory leak in wave #845

wants to merge 1 commit into from

Conversation

matthiasdiener
Copy link
Member

@matthiasdiener matthiasdiener commented Mar 3, 2023

⚠️ Not meant for merging ⚠️

cc #839

@matthiasdiener
Copy link
Member Author

matthiasdiener commented Mar 7, 2023

Impact of different workarounds on memory consumption of wave:

Workaround Mempool total Overhead/step Stable after
None (baseline) 14.6 MByte --- Step 1,500
gc.collect() every 1 step (most aggressive) 2.0 MByte 0.02 s Step 1
gc.collect() every 10 steps (current production) 4.3 MByte 2 ms Step 10
gc.set_threshold(1,1,1) 6.2 MByte 0.02 s Step 32
gc.collect(1) every 1 step 2.1 MByte 0.07 ms Step 3
gc.collect(1) every 10 steps 9.2 MByte 0.006 ms Step 15,000
gc.collect(0) every 1 step 10.5 MByte 0.07 ms Step 800
gc.collect(0) every 10 steps 14.0 MByte 0.006 ms Step 7,500
gc.collect(2) every 1 step 2.0 MByte 0.02 s Step 1
gc.collect(2) every 10 steps 4.3 MByte 2 ms Step 10
mempool.free_held() every 1 step 2 - 12 MByte 0.01 ms Step 1
gc.disable() 20,000 MByte --- ---

@matthiasdiener
Copy link
Member Author

matthiasdiener commented Mar 8, 2023

Every time step, approx. 650 objects are garbage collected with the code in this PR. A typedump of those objects is in https://gist.github.com/matthiasdiener/33956f42bbd60321c75ad2ed62ea2fc6 . A few data structures contain references to PooledSVM allocations (see e.g. line 25 in that file). Are these the objects we should focus on?

@inducer
Copy link
Contributor

inducer commented Mar 8, 2023

Possibly? They look like somewhat plausible suspects for keeping an array alive.

@matthiasdiener matthiasdiener force-pushed the debug-memleak branch 3 times, most recently from 606c5cb to b18d120 Compare March 14, 2023 18:58
@matthiasdiener
Copy link
Member Author

matthiasdiener commented Mar 15, 2023

Here is a reference graph with the objects that are garbage collected on a timestep (made with inducer/pytools#177, slightly modified to limit the number of characters shown per string).

code

@inducer
Copy link
Contributor

inducer commented Mar 16, 2023

Do the arrows in the graph point from referred to referent? (i.e. the opposite of the 'refers-to') graph?

@matthiasdiener
Copy link
Member Author

Do the arrows in the graph point from referred to referent?

Yes, this is true. I'll switch inducer/pytools#177 to point the edges in the other direction.

@matthiasdiener
Copy link
Member Author

Closing, workarounds (including gc.freeze) have been integrated in the drivers.

@matthiasdiener matthiasdiener deleted the debug-memleak branch June 26, 2023 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants