Skip to main content
13 events
when toggle format what by license comment
Mar 3, 2017 at 21:10 comment added Mr.Wizard @Iosif I didn't exactly replace it with $HistoryLength; rather I found ClearSystemCache[]; superfluous for my example, and separately I wanted to make sure that no unnecessary memory was being used to store past input/output pairs.
Mar 3, 2017 at 20:39 comment added Iosif Pinelis @Mr.Wizard : Why did you replace ClearSystemCache[] by $HistoryLength = 0 ? I am hoping to learn something here as well.
Mar 3, 2017 at 16:25 history edited Mr.Wizard CC BY-SA 3.0
added 631 characters in body
Mar 3, 2017 at 13:29 comment added Iosif Pinelis @Mr.Wizard : Thank you very much again. Your answer was very illuminating to me.
Mar 3, 2017 at 13:28 vote accept Iosif Pinelis
Mar 3, 2017 at 4:48 comment added Mr.Wizard @IosifPinelis I do not know the details of the caching scheme and I cannot at this time answer that question. It is possible that an increase in memory usage due to caching is hidden by a recovery of memory elsewhere in the system. Or it may be that caching is for whatever reason not triggered in this case.
Mar 3, 2017 at 4:32 comment added Iosif Pinelis @Mr.Wizard : Thank you very much for your answer. The only problem here that is left for me at this point is why Mathematica reported a very small memory use (2.3144d/2<1.2d) per square root when doing it just for two numbers (as indicated in the question) -- but not when doing it for 10^4 numbers. Could you please help me with this as well?
Mar 3, 2017 at 4:03 history undeleted Mr.Wizard
Mar 3, 2017 at 4:03 history edited Mr.Wizard CC BY-SA 3.0
added 837 characters in body
Mar 3, 2017 at 3:54 history deleted Mr.Wizard via Vote
Mar 3, 2017 at 3:49 comment added Mr.Wizard @happyfish I presume that the memory sharing (e.g. Share) is more efficient on that expression?
Mar 3, 2017 at 3:44 comment added vapor I found something strange, if you replace the sum with Sum[Sqrt[i], {i, 10^4}];, the resulting memory in use is small (about 56), but with Sum[Sqrt[i] // N[#, d] &, {i, 10^4}];, the result is around 4363. In terms of output, the first one is bigger. From this result, it implies Mathematica did not store the first output.
Mar 3, 2017 at 3:37 history answered Mr.Wizard CC BY-SA 3.0