in reply to Memory Usage of Perl System command
Could you please let me know how can I make sure that the memory doesn't increase
Don't run adb devices? It is the source of the memory spike. Perl will hang on to allocated memory until the script terminates.
The difference between the two numbers is how much memory that adb devices is using.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Memory Usage of Perl System command
by Anonymous Monk on Jan 08, 2016 at 23:39 UTC | |
with the output looks like this: My question was how can we release the memory allocated by the system command? I understand that perl doesn't release the memory back to OS but it should re-use the memory rather than allocating new memory block for each call, isn't that right? | [reply] [d/l] [select] |
by Laurent_R (Canon) on Jan 09, 2016 at 00:27 UTC | |
My gut-feeling idea is that the number of times you run your command is probably irrelevant to a large extent. Which would mean that you have a memory penalty for the first system call, but not really for the others, so that the memory usage would appear to be mostly reclaimed by the Perl process between the various calls. But that's only a guess, I don't really know and can't run the exact same tests. But relatively similar tests lead me to think that's probably what you will experience. | [reply] |
by pperi2 (Novice) on Jan 09, 2016 at 00:53 UTC | |
as per your suggestion, I changed the code to get the memory usage for each iteration as shown below: after 40 iterations memory has been increased as shown below: BTW as mentioned by Mr.Muskrat, I tried the script on linux station and the issue is not seen. | [reply] [d/l] [select] |
by Mr. Muskrat (Canon) on Jan 08, 2016 at 23:47 UTC | |
I guess I should have tried to run it before commenting. I assumed it was adb devices doing it. BTW, I can't reproduce the problem on Linux. | [reply] |
by pperi2 (Novice) on Jan 09, 2016 at 00:24 UTC | |
| [reply] |