Queue cleanup

Paul Rubin no.email at nospam.invalid
Mon Aug 30 00:48:41 EDT 2010


Lawrence D'Oliveiro <ldo at geek-central.gen.new_zealand> writes:
>> the CPython API means endlessly finding and fixing refcount bugs that lead
>> to either crashes/security failures, or memory leaks.
>
> I don’t see why that should be so. It seems a very simple discipline to 
> follow: initialize, allocate, free. Here’s an example snippet from my DVD 
> Menu Animator <http://github.com/ldo/dvd_menu_animator>:

In practice it has been a problem.  If it hasn't happened to you yet,
you're either burning a bunch of effort that programmers of more
automatic systems can put to more productive uses, or else you just
haven't written enough such code to have gotten bitten yet.

>> You allocate memory and shut your eyes, and the gc takes care of
>> freeing it when it figures out that you are done.
>
> And how do you run such an application? You have to limit it to a 
> predetermined amount of memory to begin with, otherwise it would easily 
> gobble up everything you have.

No that's usually not a problem-- the runtime system (generational gc)
can figure out enough from your allocation pattern to prevent the heap
from getting overlarge.



More information about the Python-list mailing list