Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using SheepShaver with SDL 1.2.14 leads to a bunch of memory leaks #526

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Using SheepShaver with SDL 1.2.14 leads to a bunch of memory leaks #526

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments


Copy link

@SDLBugzilla SDLBugzilla commented Feb 10, 2021

This bug report was migrated from our old Bugzilla tracker.

Reported in version: 1.2.14
Reported for operating system, platform: Mac OS X 10.6, All

Comments on the original bug report:

On 2009-10-31 07:55:08 +0000, Jean-Pierre wrote:

Every time the screen is refreshed (60 times per second at much), the console displays an error message:

31/10/09 12:52:59 SheepShaver-i386-SDL[7852] *** __NSAutoreleaseNoPool(): Object 0x45ebd0 of class NSWindowGraphicsContext autoreleased with no pool in place - just leaking

Looking into SDL 1.2.14 source code, the Quartz 2D UpdateRects() function in SDL_QuartzVideo.m does indeed allocate an object of type NSWindowGraphicsContext, but SheepShaver's display thread is not the main one and has no AutoReleasePool allocated.

To fix this, I added a 'CGContextRef wcg_context' field to the SDL_PrivateVideoData structure, Initialized it at the end of QZ_SetVideoWindowed():

    this->UpdateRects     = QZ_UpdateRects;
    this->LockHWSurface   = QZ_LockHWSurface;
    this->UnlockHWSurface = QZ_UnlockHWSurface;
  •    wcg_context = (CGContextRef)
  •        [[NSGraphicsContext graphicsContextWithWindow: qz_window]
  •         graphicsPort];

And used this wcg_context field in the UpdateRects() function instead of [NSGraphicsContext graphicsContextWithWindow].
No more leak.

Best regards,

  • Jean-Pierre.

On 2011-08-23 13:52:56 +0000, Ryan C. Gordon wrote:

(Sorry, some of these SDL-1.2 bugs have been sitting open for a long time.)

The problem is that you're not supposed to do SDL video calls from anything but the main thread, even if it happens to work on some platforms.

That being said, I think this is fixed in hg changeset 8e0dd46ad0e0. Feel free to reopen the bug if it isn't (and if you still care; again, sorry for the long delay!).


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

1 participant