Fix for possible memory leak on Mac

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Fix for possible memory leak on Mac

Post by phkb »

I’ve just created a PR on git that is a possible fix for a memory leak on Mac (unsure if the leak applies on Windows or Linux). Here’s a link to the PR : https://github.com/OoliteProject/Oolite/pull/446.

I don’t know if this will fix anything sound related on the Mac, but it doesn’t seem to impact my Windows build, so I’m hoping, at the very least, that this will be a stability improvement.

Anyway, this really needs some tests, preferably on Linux, but windows too, to see if you notice anything different with sound.

I’m not sure if these will work (let me know if they fail!) but here are links to the Linux and Windows builds from the PR:
Linux: https://github.com/OoliteProject/oolite ... /896720825
Windows: https://github.com/OoliteProject/oolite ... /896720827
Last edited by phkb on Fri Sep 01, 2023 5:04 am, edited 1 time in total.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5365
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Fix for possible memory leak on Mac

Post by Cholmondely »

This might tie in with just one crash (Not one from my collection of 30 crashes from v.1.91 from between Jan - May '23):




(From searching for "OOALSoundChannel.m" on my Mac:)

Start of Log:

Code: Select all

Opening log for Oolite version 1.90 (x86-64) under Mac OS X Version 10.15.3 (Build 19D2064) at 2021-10-28 18:50:47 +0000.
Machine type: MacBookAir9,1, 8192 MiB memory, 2 (4 logical) x x86 (family 0x38435547) @ 1100 MHz.
Build options: OpenAL, new planets.
Relevant (?) bits

Code: Select all

20:39:41.930 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:244): Error -1 playing source
20:39:42.062 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:244): Error -1 playing source
20:39:42.170 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:244): Error -1 playing source
20:40:01.960 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:244): Error -1 playing source
20:40:16.244 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:244): Error -1 playing source
20:40:32.094 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2425 (0x600001c3fd2c), _buffer: 0 (0x600001c3fd20))
20:40:37.110 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2424 (0x600001c3fcec), _buffer: 0 (0x600001c3fce0))
20:40:45.186 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2423 (0x600001c3fcac), _buffer: 0 (0x600001c3fca0))
20:41:18.077 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2422 (0x600001c3fc6c), _buffer: 0 (0x600001c3fc60))
20:41:56.937 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2421 (0x600001c3fc2c), _buffer: 0 (0x600001c3fc20))
20:42:20.731 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2420 (0x600001c3fbec), _buffer: 0 (0x600001c3fbe0))
20:42:38.061 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2419 (0x600001c3fbac), _buffer: 0 (0x600001c3fba0))
20:42:40.512 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2418 (0x600001c3fb6c), _buffer: 0 (0x600001c3fb60))
20:42:40.554 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2417 (0x600001c3fb2c), _buffer: 0 (0x600001c3fb20))
20:42:40.692 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2416 (0x600001c3faec), _buffer: 0 (0x600001c3fae0))
20:42:40.697 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2415 (0x600001c3faac), _buffer: 0 (0x600001c3faa0))
20:42:41.786 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2414 (0x600001c3fa6c), _buffer: 0 (0x600001c3fa60))
20:42:43.076 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2413 (0x600001c3fa2c), _buffer: 0 (0x600001c3fa20))
20:42:44.360 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2412 (0x600001c3f9ec), _buffer: 0 (0x600001c3f9e0))
20:42:45.633 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2411 (0x600001c3f9ac), _buffer: 0 (0x600001c3f9a0))
20:42:46.917 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2410 (0x600001c3f96c), _buffer: 0 (0x600001c3f960))
20:42:47.521 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2409 (0x600001c3f92c), _buffer: 0 (0x600001c3f920))
20:42:48.188 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2408 (0x600001c3f8ec), _buffer: 0 (0x600001c3f8e0))
20:42:48.295 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2407 (0x600001c3f8ac), _buffer: 0 (0x600001c3f8a0))
20:42:49.046 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2406 (0x600001c3f86c), _buffer: 0 (0x600001c3f860))
20:42:49.179 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2405 (0x600001c3f82c), _buffer: 0 (0x600001c3f820))
20:42:50.644 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2404 (0x600001c3f7ec), _buffer: 0 (0x600001c3f7e0))
20:42:50.884 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:244): Error -1 playing source
20:42:53.507 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2403 (0x600001c3f7ac), _buffer: 0 (0x600001c3f7a0))
20:42:54.370 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2402 (0x600001c3f76c), _buffer: 0 (0x600001c3f760))
20:42:58.491 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2401 (0x600001c3f72c), _buffer: 0 (0x600001c3f720))
20:42:59.655 [ov.debug] -[OOSoundChannel enqueueBuffer:] (OOALSoundChannel.m:234): Error 4294967246 queueing buffers (_source: 2400 (0x600001c3f6ac), _buffer: 0 (0x600001c3f6a0))
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Fix for possible memory leak on Mac

Post by phkb »

It’s hard to know. I don’t think it will fix the crash completely, at least based on the article I found where I got the information from. But, there might still be a benefit. Memory leaks tend to lead to crashes, so fixing one might help a bit.
User avatar
hiran
Theorethicist
Posts: 2403
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: Fix for possible memory leak on Mac

Post by hiran »

How will we ever find out if it helps on the Mac?
We'd need to compile it first...
Sunshine - Moonlight - Good Times - Oolite
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Fix for possible memory leak on Mac

Post by phkb »

At the moment, I’m just going for a “does it break the builds we have”. The ability to create a Mac build is a different issue.
User avatar
hiran
Theorethicist
Posts: 2403
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: Fix for possible memory leak on Mac

Post by hiran »

phkb wrote: Thu Aug 31, 2023 10:36 pm
Anyway, this really needs some tests, preferably on Linux, but windows too, to see if you notice anything different with sound.

I’m not sure if these will work (let me know if they fail!) but here are links to the Linux and Windows builds from the PR:
Linux: https://github.com/OoliteProject/oolite ... /896720825
Windows: https://github.com/OoliteProject/oolite ... /896720827
Trying to test - the Linux URL leads to a 404 error.
Aha, the Windows URL as well.
Sunshine - Moonlight - Good Times - Oolite
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Fix for possible memory leak on Mac

Post by phkb »

Bummer. Ok, I’ll try something else.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Fix for possible memory leak on Mac

Post by phkb »

Ok, found error in the urls. Can you try them again now?
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Re: Fix for possible memory leak on Mac

Post by another_commander »

hiran wrote: Fri Sep 01, 2023 4:35 am
Trying to test - the Linux URL leads to a 404 error.
Aha, the Windows URL as well.
There is a typo in phkb's urls - artefacts should be artifacts.

Try those links with the spelling corrected:
Linux: https://github.com/OoliteProject/oolite ... /896720825
Windows: https://github.com/OoliteProject/oolite ... /896720827

Edit: ... and of course, ninja'd...
User avatar
hiran
Theorethicist
Posts: 2403
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: Fix for possible memory leak on Mac

Post by hiran »

another_commander wrote: Fri Sep 01, 2023 5:05 am
hiran wrote: Fri Sep 01, 2023 4:35 am
Trying to test - the Linux URL leads to a 404 error.
Aha, the Windows URL as well.
There is a typo in phkb's urls - artefacts should be artifacts.

Try those links with the spelling corrected:
Linux: https://github.com/OoliteProject/oolite ... /896720825
Windows: https://github.com/OoliteProject/oolite ... /896720827

Edit: ... and of course, ninja'd...
So now I installed Oolite-trunk, and it shows up as 1.91.0.7489-230831-5cf5073.
On first glance there is no change in behaviour. That means whatever the change was - it does not make the game crash immediately.

Anything specific to lookout for?
Sunshine - Moonlight - Good Times - Oolite
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Fix for possible memory leak on Mac

Post by phkb »

Sound, specifically. High intensity battles with lots of sounds would be a great test.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Re: Fix for possible memory leak on Mac

Post by another_commander »

Since we are testing sound, it would probably be a good idea to also enable sound debug logging. This can be done by editing oolite.app/Config/logcontrol.plist and changing the below

Code: Select all

$soundDebug			= no;
to

Code: Select all

$soundDebug			= yes;
User avatar
Cholmondely
Archivist
Archivist
Posts: 5365
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Fix for possible memory leak on Mac

Post by Cholmondely »

Is there anything I can do which helps?

I don't know how to download this version of Oolite.

Nor do I know how to tweak my current version of 1.91 (last Feb's) to incorporate this seeming change to just one line of code (can't find the file).

And I've a nasty feeling that the other AppleMac sound issues will make testing for this one rather hard - too many crashes for the others which might prevent this one from surfacing
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Re: Fix for possible memory leak on Mac

Post by another_commander »

Cholmondely wrote: Fri Sep 01, 2023 6:46 am
Is there anything I can do which helps?

I don't know how to download this version of Oolite.

Nor do I know how to tweak my current version of 1.91 (last Feb's) to incorporate this seeming change to just one line of code (can't find the file).
Unfortunately there is nothing you can do for this one, unless you can setup a build environment for Mac. You cannot apply code changes without compiling from source somehow.
And I've a nasty feeling that the other AppleMac sound issues will make testing for this one rather hard - too many crashes for the others which might prevent this one from surfacing
For reference, all of the sound related crashes we have witnessed on Mac until now originate from one single point in the code - line 121 of OOSoundChannel.m: https://github.com/OoliteProject/oolite ... 34-L121C34
It is this failing assert that causes the abnormal exit in all cases.
User avatar
hiran
Theorethicist
Posts: 2403
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: Fix for possible memory leak on Mac

Post by hiran »

phkb wrote: Fri Sep 01, 2023 6:26 am
Sound, specifically. High intensity battles with lots of sounds would be a great test.
Well, it behaves as it did before. This issue for sure is not caused by your patch:
https://bb.oolite.space/viewtopic.php?p=290907#p290907
Sunshine - Moonlight - Good Times - Oolite
Post Reply