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
[email protected]
http://lists.create.ucsb.edu/mailman/listinfo/media_api
_______________________________________________
media_api mailing list
[email protected]
http://lists.create.ucsb.edu/mailman/listinfo/media_api

Reply via email to