Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/FireMonkey/Components    [ Add a report in this area ]  
Report #:  127662   Status: Open
[MacOS] TMediaPlayer Play function causes major memory leak
Project:  Delphi Build #:  21.0.17017.3725
Version:    21.0 Submitted By:   Anthony Burgoyne
Report Type:  Crash / Data loss / Total failure Date Reported:  9/17/2014 2:50:45 PM
Severity:    Critical / Show Stopper Last Updated: 9/17/2014 7:32:13 PM
Platform:    All Mac platforms Internal Tracking #:   55209
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 20
Playing a CAF file by using the TMediaPlayer's Play function causes a major memory leak, as well as thread and port resource leaks.

If you call Play enough, it will causes an 'out of memory' error.
Steps to Reproduce:
1. Create a new FireMonkey project.
2. Add a TMediaPlayer to the form.
3. Add a TButton to the form.
4. Add the following code:
5. Activate OS X as your target deployment.
6. Add a test.caf audio file to your Project -> Deployment files list.
7. Run the program.
9. Click the button repeatedly, observing resource usage in the OS X Activity Monitor.

void __fastcall TForm1::Button1Click(TObject *Sender)
  MediaPlayer1->FileName = GetAppFolder () + "test.caf";
  MediaPlayer1->Play ();

String TForm1::GetAppFolder ()
  String exeFile;
  String exePath;
#ifdef WIN32
  exeFile = System::ParamStr (0);
#ifdef __MACH__
  char16_t buffer [512];
  System::GetModuleFileName (NULL, buffer, 512);
  exeFile = buffer;
  exePath = ExtractFilePath (exeFile);
  return exePath;


Server Response from: ETNACODE01