Results 1 to 18 of 18

Thread: [RESOLVED] CopyMemory Shift Array one position

Threaded View

  1. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2010
    Posts
    1,103

    Re: CopyMemory Shift Array one position

    Quote Originally Posted by Milk View Post
    I've not used VB6 in a while but...

    It looks to me like you are just copying the safearray pointers rather than the data.

    If any of these are lost as a result of the copymemory call (eg. #999) I think you will get a leak. Manually deallocate any of these before the call to copymemory (Erase m_CellRows(999)).

    The copymemory call from the example will also create a second reference to array #2. After the call I think the original needs to be deallocated using copymemory or similar to avoid the garbage collection running twice on the same object (something like CopyMemory ByVal VarPtr(m_CellRows(2)), 0, 4)
    Thank you,Milk. It needs CopyMemory ByVal VarPtr(m_CellRows(2)), 0, 4 to do garbage clean. After I put this, the data looks OK. Without this, the data got mad even though no crash.

    Thanks Bonnie West.
    Last edited by Jonney; Jan 21st, 2013 at 07:04 PM. Reason: Give thanks

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