|
-
Jan 21st, 2013, 07:00 PM
#3
Thread Starter
Frenzied Member
Re: CopyMemory Shift Array one position
 Originally Posted by Milk
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|