Page 1 of 1

Power CDG Control Still Has A Memory Leak Problem

Posted: Tue Apr 24, 2007 9:28 am
by runner3735
I am trying out the Power CDG Control. I am using Visual Studio 2005 on a WinXP system, and programming in Visual Basic .NET.

Each time a new file is loaded using the LoadFile method, more memory is used, and the memory used by the previous file is not released.

This behavior even occurs with the included sample VB project.

I thought I could get around this by instantiating a new AxPowerPlayCDG for each new file played, but that did not solve the problem.

Here are my subroutines for creating and disposing the control:

Private Sub InitializeCDG()
MyCDG1 = New AxPowerPlayCDGLib.AxPowerPlayCDG
MyCDG1.Name = "MyCDG1"
MyCDG1.Location = New System.Drawing.Point(12, 12)
MyCDG1.Size = New System.Drawing.Size(343, 258)
Controls.Add(MyCDG1)
MyCDG1.Enabled = True
End Sub

Private Sub RemoveCDG()
Controls.Remove(MyCDG1)
MyCDG1.Dispose()
MyCDG1 = Nothing
End Sub

Basically, each time I want to play a CDG, I call the InitializeCDG routine to create a new control. Then, when I am done playing the CDG file, I call the RemoveCDG routine. I thought that the RemoveCDG routine would free up all the memory used by the control, but it doesn't.

I saw the previous thread (in 2005) regarding this problem, but there was no resolution. I am using the unregistered version, so any tests of this behavior should also use the unregistered version. In the previous thread, it wasn't clear what versions people were using.

Posted: Tue Apr 24, 2007 11:36 am
by admin
This is strange -- using the control in Visual C++ does not cause any problems. We will look into this, but I cannot promise it will be resolved soon.

Posted: Tue Apr 24, 2007 1:19 pm
by runner3735
Well, I discovered something interesting.

If you get rid of the MP3's, then the memory leak problem goes away. In other words, it appears that your control is loading the CDG and MP3 into memory, but, when a different file is loaded, only the CDG memory is freed, while the MP3 remains in memory.

Here is a completely stripped application that demonstrates the problem. It is a form with a single button.

Public Class CDGPlayer

Dim PPCDG As AxPowerPlayCDGLib.AxPowerPlayCDG
Dim CDGs As ObjectModel.ReadOnlyCollection(Of String)
Dim NowPlaying As Integer

Private Sub CDGPlayer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CDGs = My.Computer.FileSystem.GetFiles("D:\Karaoke\Temp", FileIO.SearchOption.SearchAllSubDirectories, "*.cdg")
PPCDG = New AxPowerPlayCDGLib.AxPowerPlayCDG()
PPCDG.Name = "PPCDG"
PPCDG.Location = New System.Drawing.Point(12, 12)
PPCDG.Size = New System.Drawing.Size(343, 258)
Controls.Add(PPCDG)
PPCDG.Enabled = True
End Sub

Private Sub PlayButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PlayButton.Click
If NowPlaying = CDGs.Count Then Exit Sub
PPCDG.LoadFile(CDGs(NowPlaying))
PPCDG.Play()
NowPlaying = NowPlaying + 1
End Sub

End Class

Posted: Tue Apr 24, 2007 1:32 pm
by admin
The control uses DirectX for MP3 playback -- have you tried updating DirectX and checking if it helps?

Memory leak

Posted: Thu May 24, 2007 6:03 am
by Spraggy
I am having exactly the same problems.
after a hundred or so files, my application crashes.
This also happens with the directX filter - Power CDG control

any help please!

Memory Leak

Posted: Thu May 24, 2007 6:23 am
by Spraggy
I have just removed current version of CD+G Control and installed the developer POWER CD+G FILTER v.1.0.11

NO MEMORY LEAK !!!!

I don't have a old version of the OCX filter to try, but it looks like something has changed in the DEVELOPER VERSION to cause this

Hope this helps

Posted: Tue Aug 28, 2007 7:07 am
by Karl580
Just wondering if there is any movement on this bug.
My karaoke crashes at least once per night due to this memory problem.
All seems to have gone quiet on the forum, is the problem still being look into and will there be a working control available soon ?

Posted: Tue Aug 28, 2007 7:59 am
by admin
Karl, are you using developer control?

Posted: Fri Aug 31, 2007 9:38 am
by Karl580
Yes I am using the full version of the developer control, I am running Windows XP SP2 with 1GB of ram.
The software is written in VB6 SP5
After playing 15 or so CDG's the software closes down without reporting any error.

Posted: Sun Aug 17, 2008 10:29 am
by ben
Possibly related :

If you call the close function of the object (which according to help releases all files) - windows won't let you delete the mp3 (cdg is ok) - saying the file is still locked.

Could this be why the memory is leaking?

Posted: Fri Dec 12, 2008 12:18 am
by Workmen
ben wrote:Possibly related :

If you call the close function of the object (which according to help releases all files) - windows won't let you delete the mp3 (cdg is ok) - saying the file is still locked.

Could this be why the memory is leaking?
Yes this is correct, there is no memory leak, the mp3 file is locked by the activex! Once locked and not released it takes termination of the app to release it! The developer control will not release the file locks on mp3 file when close method is executed most times. The cdg file lock is always released! This makes the control unuseable! Please correct this problem as there is no workaround!

Workmen