Results 1 to 3 of 3

Thread: Memory Leak in Subclass lib of vbAccelerator

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2012
    Posts
    1

    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

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3
    New Member
    Join Date
    May 2012
    Posts
    1

    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
  •  



Click Here to Expand Forum to Full Width