4 ms·
> you're looking at a rewrite at that point; probably in a language your team doesn't know and doesn't like Or you commit atrocities like rip the garbage colle
by saagarjha 7y ago
> you're looking at a rewrite at that point; probably in a language your team doesn't know and doesn't like
Or you commit atrocities like rip the garbage collector out of Python. I’m not joking; Instagram did this: https://instagram-engineering.com/dismissing-python-garbage-collection-at-instagram-4dca40b29172 https://instagram-engineering.com/dismissing-python-garbage-...
- overgard 7y agoHeh! That is fantastic!
- lasagnaphil 7y agoThat’s actually a pretty clever (and crazy) idea, because when you disable the gc in Python the reference counting still works and only the cycle detection part is vanished. So you are just dealing with reference semantics the same as C++’s shared_ptr or Swift’s references, which isn’t that hard to use if you are careful about cyclic refs. And if the memory leak exceeds a certain amount they can just restart the process.
- tyingq 7y agoThat's also how Perl functions. No generational GC, just ref counting. So you're fine if you don't make circular references.
- Doxin 7y agoDisabling the python GC like that isn't that crazy. They didn't add gc.disable() because you shouldn't use it. The crazy part is some library calling the gc directly without a way to disable it. That's just bad form. A lot of games in gc-ed languages turn the gc off, and then manually run the gc whenever there's some spare time in a frame. The same thing should more or less work for a server handling web requests too. Maybe run it after every request or perhaps every couple of requests depending on memory usage.