hrm i think i maybe??? found a way specific to QB# to make Bacon's simple synchronous cycles collector iterative 🤔
the problem with analyzing one potential reference cycle root at a time is that you can get quadratic complexity, which they illustrate using this figure
as i understand it the problem is if you trace these roots from left to right, assuming they're labeled A, B, C, D in order of appearance, you trace:
- A
- A + B
- A + B + C
- A + B + C + D
so you're doing 2.5 times the work to collect the garbage, and that's... bad
i'm looking at cycles collectors because it's too hard, in QB#, to actually know 100% certain what references are actually coming from the stack
but you DO know when a refcount being decreased came from the stack, aka from a root into the object graph:
in their approach you mark an object in the heap purple, a potential reference cycle root keeping garbage allocated, if its reference count decrements but doesn't hit zero
the problem is you have no further context
but we can pass along context on whether the decrement came from the freeing of a root on the stack, so for every branch in a cascade of refcount decreases, the first time you mark an object purple, instead you can mark it i dunno, red, and anything further down is marked purple
because you know the decrease came from a "true" reference root, the stack, you should be able to infer that red nodes are way more likely to be the true root of a section of garbage memory than purple nodes
i.e. red nodes are more likely to be the far right node in this figure
so presumably if you trace red nodes first you're less likely to repeatedly trace over parts of an object graph working your way down to the actual root of a section of garbage?
i dunno, though, my intuition on this one could be extremely off >_> but it feels like it makes sense to me that the closer a potential reference cycle root is to an actual root to the heap the more likely it is that its the root of a section of garbage
Bacon solves the problem of quadratic complexity by analyzing the entire graph all at once, in a stop-the-world style, because if you do all the work all at once you're not redoing any of the work
maybe by analyzing red nodes first, i can do the work in smaller, iterative steps
the problem, of course, is that i have no way to test this hypothesis since i can't find anything online about how to write a program that is designed to create garbage in order to "test" a garbage collection algorithm :D
suppose the flipside of this approach is that if the potential root is NOT a garbage root then you're tracing way more memory to find that out which would definitely be bad 🤔 and not something that would be a problem if you're tracing /all/ roots
• • •
Missing some Tweet in this thread? You can try to
force a refresh
WFH is not breaking people, WFH during a pandemic where nobody gets to hang out with their friends or do most of the things they normally would do as an outlet is breaking people
Come on people, WFH is not the problem here
I've worked from home since 2015 and I've never had an issue until THE LITERAL PANDEMIC happened. Science shows that the #1 best way to get a permanent boost in happiness without hedonic adaptation is to SHORTEN COMMUTE TIMES
IT'S NOT THE WFH. IT'S THE APOCALYPSE
For real imagine putting a problem like "there is no clear transition between work and home" that is pretty fixable on the level of "I have to sit in my car 2 hours out of every day because if I don't I will become homeless"
had my 2nd shot of pfizer about 2 hours ago. will update this thread with how things go! fingers crossed it doesn't knock me on my ass
the only thing i'm worried about is on my official "i've been vaccinated" card they dropped an 'a' from my last name :/ hope that doesn't cause me trouble down the line...
not much to report so far. a little over 5 hours. had some arm/shoulder tingles, shoulder is a bit tender, that's about it
honestly given how scary people make garbage collection sound it doesn't seem that bad?
... famous last words, to be sure, but
People have decided to take up residence in the comments to my tweet talking about GC /development/ to rehash the same tired arguments about whether GC is good at all so I'm gonna mute this because tbh that is extremely not a discussion I wanna see
If you want my take on it it's that GC sucks and manual memory management sucks too, because resource management sucks no matter what ¯\_(ツ)_/¯
(program runs)
copy reference graph from potential root 1
(program runs)
trace graph and free any garbage
(program runs)
copy reference graph from potential root 2
(program runs)
trace graph and free any garbage
etc
and this should work because copying a section of the graph means the actual heap can keep changing, but garbage can never change (nothing references it) so the portions that are determined to be garbage can safely be freed
This is a big topic so this'll probably be a bit of a thread
Save games are hard primarily because modern programming doesn't just let you take chunks of raw bytes from RAM, write them to disk, then later put them back and have the same state you had before 1/
In fact modern languages/OSes mostly don't let you access memory in this way at all. This approach is how emulator savestates work: they just dump all the working memory to disk, and then reload it, and it basically restores the state of the entire machine. 2/
So instead you get what's called "serialization". Serialization roughly means taking an object that exists in memory and manually (or semi-automatically) converting that into a set of primitive values like numbers, true/false, and text. 3/
Gamers really think that most indie devs are trying to get EGS deals while accumulating Steam wishlists when 99.9% of us know we have got zero chance of that and we're not even anywhere on the same continent as Epic's radar let alone on it
The reality is that the vast majority of indies impacted by this new legalese are tiny indies with tiny budgets doing early access on itch to make sure their games are the best and most bug free they can be before they hit Steam, so think about that before you gloat about this
You're gloating about the 1% in indie game development getting screwed by this when it mainly just fucks up indie devs who are legitimately trying to launch their games on Steam and want to make sure they're not a buggy mess on launch for Steam users