[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] garbage collector?



"Michael Benfield" <mike@duckbrain.com> writes:

> Hello,
> 
> There's something I've been wondering for a while, and my efforts to
> find out on my own have been completely unsuccessful, so I figured I'd
> ask some people who might know. I hope no one minds me asking a question
> not directly related to using Pygame.
> 
> I tried looking at the Pygame C source code to figure this out;
> unfortunately ever since I started using Python C gives me a headache
> and I was unable to continue. Basically I am wondering... does Python's
> garbage collector take care of stuff allocated from C also?

No.

> For instance, I'm assuming that when you create a Pygame Surface,
> Pygame creates an SDL_Surface. Now if Python garbage collects that
> Pygame Surface, does it automatically free that SDL_Surface also or
> does Pygame have to take care of that somehow? If Pygame does it,
> what is involved in doing that?

Pygame should do that in the Surface type's tp_dealloc method.

Cheers,
M.

-- 
  I saw `cout' being shifted "Hello world" times to the left and
  stopped right there.                                -- Steve Gonedes
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org