延续先前的问题~因为结构体会增长~要如何在循环中使用CopyMemory?
这次我贴上我的完整结构~我尝试写在循环外或内~只要使用过CopyMemory~之后结构体内容如果有变动~整个VB都会被关闭~这问题请高手协助~或经验分享一下要怎做会比较好~因为被分析的资料~量都是以GB计算的~所以不可能全解析完成再用CopyMemory~感觉好像是什么释放的动作没做~导致程序死当~事实上每次处理完一个Flow我会ReDim一次~不然到100左右内存会爆掉~
想让每次处理完一个Flow()~新增一个Flow()前~就回传一次~
Form1
程序代码:
Option Explicit Dim QQQ As New Class1 Private Sub Form_Load() Call AAA End Sub Private Sub AAA() QQQ.Run MsgBox WWW.Device_Name End Sub
Module1
程序代码:
Option Explicit Public Enum ICMmode None = 0 CP = 1 FT = 2 End Enum Public Type MeasuredValue MValue As String 'Pin脚量测值 MUnit As String 'Pin脚量测单位 End Type Public Type PinContent PinName As String 'Pin脚名称 PinForce As MeasuredValue 'Force值 PinForcerng As MeasuredValue 'ForceRange值 PinMin As MeasuredValue 'Min值 PinMax As MeasuredValue 'Max值 PinMeas As MeasuredValue 'Meas值 PinMeasrng As MeasuredValue 'MeasRange值 PinResult As String 'Pass or Fail SearchedStart As String 'TMU值 Windows As MeasuredValue 'Windows值 ResultValue As MeasuredValue 'Result.Value值 PattenName As String 'Function Patten名称 PattenNumber As String 'Function Patten编号 Start As String 'Function Start值 End As String 'Function End值 Size As String 'Function Size值 VRang As MeasuredValue 'DPS值 IRang As MeasuredValue 'DPS值 ClampH As MeasuredValue 'DPS值 ClampL As MeasuredValue 'DPS值 End Type Public Type Pin PinData() As PinContent 'Pin脚测试资料 PinNum As Integer 'Pin脚总数 ItemResult() As String 'Pass or Fail End Type Public Type Bin SoftBin As Integer 'Software Bin Number HwardBin As Integer 'Hardward Bin Number End Type Public Type Site SiteData() As Pin '该SiteNum中的资料 SiteNum As Integer 'Site数量 SiteCount As Integer 'Site数量计算 ItemType As String 'ItemTest类型 ItemTestTime As String 'ItemTest时间 + 日期 SiteBin() As Bin 'SiteBin编号 ItemTestName As String 'ItemTest名称 End Type Public Type ItemTest ItemTestData() As Site '该ItemTest中的资料 ItemTestNumber As Integer '该SubTest中ItemTest总数 SubTestName As String '该ItemTest所属SubTest名称 SubTest_ID As String '该SubTest ID编号 SubTest_FailBin As String '该SubTest Fail Bin Number End Type Public Type Coordinate X As Integer 'X座标 Y As Integer 'Y座标 End Type Public Type SubTest SubTestData() As ItemTest '该SubTest中的资料 SubTestNumber As Integer '该Flow中SubTest总数 FlowTestTime As String '该Flow测试时间 + 日期 FlowTestCoordinate As Coordinate '工程模式下的测试座标 Test_Dut_Count As Integer '该Flow中Dut数 End Type Public Type CPMode Data_Log_Vesion As String 'Data Log Vesion Lot_ID As String 'Lot ID(CP) Wafer_ID As String 'Wafer ID(CP) Prober_Temperature As String 'Prober Temperature(CP) Probe_card_number As String 'Probe Card Number(CP) End Type Public Type FTMode Customer_Lot_ID As String 'Customer Lot ID(FT) Internal_Lot_ID As String 'Internal Lot ID(FT) Dut_Board As String 'Dut Board(FT) End Type Public Type Flow FlowData() As SubTest '该Flow中的资料 FlowNumber As Integer '该Log档中Flow的总数 MCP As CPMode 'IC种类(CP) MFT As FTMode 'IC种类(FT) LogFileName As String 'Log档所在路径位置 StartTestTime As String '该Log档的测试时间 + 日期 PC_Name As String 'PC Name IP_Address As String 'IP Address EndTestTime As String '该Log档的结束测试时间 + 日期 Project_Path As String 'Project Path Test_DUTs As String 'Test DUTs Test_Mode As String '工程模式或是量产模式 Flow_Name As String '该Log档的Flow名称 Device_Name As String 'Device Name Device_Pin_Count As String '测试Pin脚总数 End Type Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef Destination As Flow, ByRef Source As Flow, ByVal Length As Long) Public WWW As Flow
Class1
程序代码:
Option Explicit Private ABC As Flow Public Sub Run() Call Assign End Sub Private Function Assign() As Boolean Dim i As Integer For i = 0 To 5 ABC.FlowNumber = i ReDim ABC.FlowData(ABC.FlowNumber) ABC.FlowData(ABC.FlowNumber).SubTestNumber = 123 ABC.Device_Name = "123" Next i CopyMemory WWW, ABC, CInt(LenB(ABC)) '问题会从这行之后开始产生~ For i = 6 To 10 ABC.FlowNumber = i ReDim ABC.FlowData(ABC.FlowNumber) ABC.FlowData(ABC.FlowNumber).SubTestNumber = 123 ABC.Device_Name = "123" Next i End Function