
Originally Posted by
ninja9578
Is it possible to shut off the garbage collector? Professionals hate garbage collectors.
Professionals don't hate garbage collectors. Professionals like to get as much work done with as little code as possible in the most readable manner because that allows for a better program. That's why professionals use python when it's appropriate.
Anyway, your example is garbage. You are referring to a limitation of the C library pthreads which has nothing to do with either garbage collection or threading in general.
Python
Code:
import threading
mutex = threading.lock()
# critical section
with mutex:
if something:
return something
elif something_else:
return something_else
# mutex is automatically released when we exit the with block through any path
# this includes uncaught exceptions
See why professionals like python where it's appropriate?
When you started talking about garbage collectors, I thought you were going to bring up the usual (and valid) criticism that they can pause program execution when they are running. so you would not want a garbage collector in a pacemaker or other time critical piece of software. Given the fact that most large C/C++ programs for which this is not a concern end up manually reinventing a garbage collector anyways (or using a third party one, or leaking like the titanic), i think that it's just that much more ridiculous for you to claim that 'professionals' don't like garbage collectors and reflects a sort of macho, speed is everything attitude that I often see from C/C++ programmers.
I think it's because you're mad that a long running java (ugh!) process can outperform a long running C++ process due to microoptimizations that the JITC can make based on runtime conditions that aren't available to even the smartest static compilers.
Bookmarks