Timeline for Using delayed evaluation on module variables called through an association
Current License: CC BY-SA 3.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 7, 2016 at 17:28 | history | edited | Sascha | CC BY-SA 3.0 | deleted 8 characters in body |
| Jun 10, 2016 at 9:27 | comment | added | Kuba | @LeonidShifrin I will drop my comments about Temporary then, don't want to confuse others. | |
| Jun 10, 2016 at 9:17 | comment | added | Leonid Shifrin | @Kuba It is hard for me to say what's wrong in the example you linked, from a quick look, but my feeling is that the problem is hardly in Temporary attributes (although I may well be wrong). Something to look into, when I get a spare moment. But normally, Module -generated variables captured by UI elements are simply considered referenced from the GC, and work just fine within a single Mathematica session - at least this has been my experience. | |
| Jun 10, 2016 at 6:58 | comment | added | Kuba | Yep, maybe I should add I'm avoiding them just in case, I don't know internals enough and better be safe than sorry. @LeonidShifrin here's another case, which I don't know if is for sure Temporary fault but a "conservative" approach works stable: mathematica.stackexchange.com/q/116117/5478 | |
| Jun 9, 2016 at 21:00 | comment | added | Leonid Shifrin | You don't have to worry about them. Module assigns Temporary attribute to them automatically. They are collected after no longer referenced, this is also automatic. The only cases I know of, which are problematic, I discussed in this answer. So, basically, if your use case does not involve any of those subtle cases, just use those Module variables and don't worry about GC (don't forget set $HistoryLength to zero when working in the FrontEnd). | |
| Jun 9, 2016 at 19:18 | comment | added | Sascha | @LeonidShifrin I don't expect to handle a lot of those variables. Could you, in the light of Kuba's answer, elaborate on the mechanics of garbage collection? Kuba mentions that those module variables have the Temporary-attribute. | |
| Jun 9, 2016 at 8:32 | comment | added | Leonid Shifrin | You don't need to worry about those variables. As soon as they are no longer referenced by anything (like when you no longer use the resulting assoc in any other place), they will be GCd. So, to me, this is a non-issue, unless you have millions of such assocs in use at the same time. | |
| Jun 8, 2016 at 21:50 | answer | added | Kuba | timeline score: 5 | |
| Jun 8, 2016 at 21:26 | history | edited | Sascha | CC BY-SA 3.0 | edited body |
| Jun 8, 2016 at 21:12 | history | asked | Sascha | CC BY-SA 3.0 |