|
-
Mar 30th, 2012, 02:12 AM
#1
Thread Starter
New Member
Memory Leak in Subclass lib of vbAccelerator
Hi, i'm using the vbAccellerator treeview ocx.
I've noted that when i start and stop many time my application the treeview crash for out of memory.
I tried also to use other ocx that uses the vbaccelerator subclass lib and also them crash like the treeview.
In debug mode i saw that after a number times that i restart my application
the GetProp line of Get MessageClassCount method of subclass.bas file returns zero and it raise the error.
The subclass.bas is here:
http://www.vbaccelerator.com/home/VB...bclass_bas.asp
Is there anyone can know how fix it or has an update version of this lib?
The memory occupied is not the normal memory i tried to use task manager and enabled the user object in it but nothing happens. How can i check the memory that is full?
thanks
-
Mar 30th, 2012, 08:43 AM
#2
Re: Memory Leak in Subclass lib of vbAccelerator
I doubt the subclass routines are causing memory leaks. The routines are basically trying to read/write to a property on a window. Looks to be a few property names used, but just a few. I would think the memory leak probably resides in the custom drawn controls.
Now when you say start & stop your application, THIS IS IMPORTANT: How are you starting stopping your application? If you are pressing the STOP button VB's IDE toolbar, you are creating the memory leaks if the custom-drawn control is not compiled. When using custom-drawn controls that are not compiled, always close your project normally, by using the X close button or pressing Alt+F4, as applicable.
In my signature below is a link to a FAQ regarding memory leaks, you may find it useful.
-
May 24th, 2012, 07:16 PM
#3
New Member
Re: Memory Leak in Subclass lib of vbAccelerator
There is a problem with the subclass.bas, it doesn't remove window properties properly. These are the updated functions:
Private Property Let MessageCount(ByVal hwnd As Long, ByVal count As Long)
Dim sName As String
m_f = 1
sName = "C" & hwnd
If (count = 0) Then
RemoveProp hwnd, sName
Else
' When we update the message count, we need to remove the property first (even if the key name
' is the same).
RemoveProp hwnd, sName
m_f = SetProp(hwnd, sName, count)
End If
' logMessage "Changed message count for " & Hex(hwnd) & " to " & count
End Property
Private Property Let OldWindowProc(ByVal hwnd As Long, ByVal lPtr As Long)
Dim sName As String
m_f = 1
sName = hwnd
If (lPtr = 0) Then
RemoveProp hwnd, sName
Else
m_f = SetProp(hwnd, sName, lPtr)
End If
' logMessage "Changed Window Proc for " & Hex(hwnd) & " to " & Hex(lPtr)
End Property
Private Property Let MessageClassCount(ByVal hwnd As Long, ByVal iMsg As Long, ByVal count As Long)
Dim sName As String
sName = hwnd & "#" & iMsg & "C"
If (count = 0) Then
RemoveProp hwnd, sName
Else
m_f = SetProp(hwnd, sName, count)
End If
' logMessage "Changed message count for " & Hex(hwnd) & " Message " & iMsg & " to " & count
End Property
Private Property Let MessageClass(ByVal hwnd As Long, ByVal iMsg As Long, ByVal index As Long, ByVal classPtr As Long)
Dim sName As String
sName = hwnd & "#" & iMsg & "#" & index
If (classPtr = 0) Then
RemoveProp hwnd, sName
Else
m_f = SetProp(hwnd, sName, classPtr)
End If
' logMessage "Changed message class for " & Hex(hwnd) & " Message " & iMsg & " Index " & index & " to " & Hex(classPtr)
End Property
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|