Timeline for Bash wait command actually gets result from background job cache, would the cache cause memory leak when it creates background jobs continuously?
Current License: CC BY-SA 4.0
20 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| S May 10, 2023 at 9:27 | vote | accept | osexp2000 | ||
| May 9, 2023 at 10:57 | answer | added | aviro | timeline score: 2 | |
| May 8, 2023 at 10:27 | comment | added | osexp2000 | @aviro yes, I have updated EDIT part of the question, test3 is not contradictory with test2. The reason why test2 does not run out of memory maybe just because it takes much time or Bash did some cleanup work in some timing. | |
| May 8, 2023 at 10:23 | vote | accept | osexp2000 | ||
| S May 10, 2023 at 9:27 | |||||
| May 8, 2023 at 7:14 | comment | added | aviro |
I hope it's clear now that test3 didn't "run out of memory", it just hit the nproc limit. So it wasn't related to bash or to your question at all.
|
|
| May 7, 2023 at 16:42 | history | edited | osexp2000 | CC BY-SA 4.0 |
added 327 characters in body
|
| May 7, 2023 at 16:26 | history | edited | osexp2000 | CC BY-SA 4.0 |
added 145 characters in body
|
| May 7, 2023 at 15:58 | history | edited | osexp2000 | CC BY-SA 4.0 |
deleted 5 characters in body
|
| May 7, 2023 at 15:51 | comment | added | osexp2000 |
I still don't understand is that why test2 does not run out of memory? based on my observation, Bash caches all exit codes. There might be something I still don't know.
|
|
| May 7, 2023 at 15:45 | comment | added | osexp2000 | @aviro thanks for taking a look at it. I have updated the test code and result as your suggestion. | |
| May 7, 2023 at 15:45 | history | edited | osexp2000 | CC BY-SA 4.0 |
added 201 characters in body
|
| May 7, 2023 at 15:38 | comment | added | aviro |
You should show in your question that if you run wait $PID1 AGAIN at the end, after you waited for PID2, it would show the exit status of PID1, which proves that bash keeps the results of the the children in the memory, and that's your main point.
|
|
| May 7, 2023 at 15:28 | history | edited | osexp2000 | CC BY-SA 4.0 |
deleted 4 characters in body
|
| May 7, 2023 at 15:21 | history | edited | osexp2000 | CC BY-SA 4.0 |
deleted 4 characters in body
|
| May 7, 2023 at 15:16 | history | edited | osexp2000 | CC BY-SA 4.0 |
added 735 characters in body
|
| May 7, 2023 at 15:07 | history | edited | osexp2000 | CC BY-SA 4.0 |
added 533 characters in body
|
| May 7, 2023 at 12:22 | history | edited | osexp2000 | CC BY-SA 4.0 |
added 132 characters in body
|
| May 7, 2023 at 12:03 | history | edited | osexp2000 | CC BY-SA 4.0 |
added 137 characters in body
|
| May 7, 2023 at 11:58 | answer | added | Chris Davies | timeline score: 2 | |
| May 7, 2023 at 11:53 | history | asked | osexp2000 | CC BY-SA 4.0 |