Hello,

For what it worth, I noticed in my application using PortMIDI (OSX) that the 
file /Users/<me>/Library/Preferences/com.apple.java.util.prefs.plist
is open at calling "Pm_Initialize" (I guess in order to get the default devices 
etc.) but is never closed, even after "Pm_Terminate"

As a consequence the application retains this file open and fails after too 
many Intialize/Terminate calls (which I often tend to do to refresh the 
devices).

Jean



Le 24 juin 2014 à 16:56, Roger Dannenberg <r...@cs.cmu.edu> a écrit :

> Hi Andreas,
>     Thanks for letting me know. I don't consider not freeing everything 
> allocated to be a "memory leak" or an error,  but if PortMidi allocates new 
> memory every time you call Pm_Initialize(), that's a (minor) problem.
>     A quick check indicates Pm_Terminate is freeing device descriptors, but 
> there may be some other (maybe system-specific) memory that's not freed. I'll 
> take a look.
>     Yours,
>     Roger
> 
> On 6/24/14 10:17 AM, Andreas Eriksson wrote:
>> Hi.
>> 
>> I was playing around with PortMidi earlier and noticed a memory leak. The 
>> memory leak can be reproduced with this simple example program:
>> 
>> #include <portmidi.h>
>> int main(void) {
>>   Pm_Initialize()
>>   Pm_Terminate()
>>   return 0;
>> }
>> 
>> Running this with AddressSanitizer (a memory error checker) reports that 
>> some memory is still allocated when the program exists. The number of 
>> objects that are still allocated is the same as the number of midi devices 
>> found by portmidi. So it would seem that portmidi allocates something for 
>> each device when Pm_Initialize() is called, but doesn't free it when 
>> Pm_Terminate() is called. The platform I noticed the problem on was Linux 
>> with the ALSA API.
>> 
>> I've decided against using PortMidi for my projects so I'm not going to 
>> spend any more time investigating this problem, but I figured I should at 
>> least let you know that it exists.
>> 
>> 
>> _______________________________________________
>> media_api mailing list
>> media_api@create.ucsb.edu
>> http://lists.create.ucsb.edu/mailman/listinfo/media_api
> _______________________________________________
> media_api mailing list
> media_api@create.ucsb.edu
> http://lists.create.ucsb.edu/mailman/listinfo/media_api

_______________________________________________
media_api mailing list
media_api@create.ucsb.edu
http://lists.create.ucsb.edu/mailman/listinfo/media_api

Reply via email to