Garryt1
07-21-2003, 09:32 AM
Hi ,
I have a program written in vb6 which is flagging an out of memory error when a process takes place. Can anyone suggest to me why this would occur so as i can look at my code again?
Mikecrosoft
07-21-2003, 09:35 AM
we need code to check where the OUT OF MEMORY its happening, please post some code for us. ;)
Thinker
07-21-2003, 09:35 AM
First place to look is large amounts of string concatenation, especially
with large strings.
Garryt1
07-21-2003, 09:54 AM
First place to look is large amounts of string concatenation, especially
with large strings.
Hi,
Text1 is data from the plc loaded when the form loads,i then convert to double from string so i can manipulate the polygon size.
Private Sub Text1_Change()
Dim hRgn As Long
Dim handle As Long
Dim point(4) As POINTAPI
Dim Data0 As Double
Dim Data1 As Double
Text2.LinkTopic = "RSLinx|PPU" 'Pieces into mill
Text2.LinkItem = "N17:51,L1,C1"
Text2.LinkMode = 1
Text2.LinkRequest
Text8.LinkTopic = "RSLinx|PPU" 'Pieces into box
Text8.LinkItem = "N17:52,L1,C1"
Text8.LinkMode = 1
Text8.LinkRequest
Text4.LinkTopic = "RSLinx|PPU" 'Banner Array volume
Text4.LinkItem = "F8:5,L1,C1"
Text4.LinkMode = 1
Text4.LinkRequest
Text5.LinkTopic = "RSLinx|PPU" 'Average Log Diameter
Text5.LinkItem = "N17:57,L1,C1"
Text5.LinkMode = 1
Text5.LinkRequest
Text10.LinkTopic = "RSLinx|PPU"
Text10.LinkItem = "N17:1,L1,C1"
Text10.LinkMode = 1
Text10.LinkRequest
Text11.LinkTopic = "RSLinx|PPU"
Text11.LinkItem = "N17:7,L1,C1"
Text11.LinkMode = 1
Text11.LinkRequest
Data0 = Text10.Text / 10
Data1 = Text11.Text / 10
handle = Picture1.hdc
Picture1.Cls
point(1).x = 676
point(1).y = 135 + Data1
point(2).x = 675
point(2).y = 230 + Data1
point(3).x = 58
point(3).y = 240 + Data0
point(0).x = 57
point(0).y = 120 + Data0
Dim point1(4) As POINTAPI
Dim handle1 As Long
Dim hRgn1 As Long
handle1 = Picture1.hdc
point1(1).x = 678 'end length top
point1(1).y = 133 + Data1 'top height point
point1(2).x = 677 'end length bottom
point1(2).y = 231 + Data1 'bottom height point
point1(3).x = 56 'bottom start point length
point1(3).y = 241 + Data0 'bottom start point height
point1(0).x = 55 'top start point length
point1(0).y = 118 + Data0 'top start point height
hRgn1 = Polygon(handle1, point1(0), 4)
hRgn = Polygon(handle, point(0), 4)
End Sub
TheRealWoody
07-21-2003, 10:20 AM
...another place where it's easy to create this error, especialy after a long day, is in your property let's. eg.
Property Let MyProp(sNewVal as String)
MyProp = sNewVal
End Property
Just a thought.
Boris
07-21-2003, 11:13 AM
Also if youre running lots of programs this could happen,
although i dont belive thats the case right now.
I've noticed that sometimes vb generates this error
for no real reason. There may be an error in the code,
and vb "crashes" for some reason, and reports its out
of memory. This is especially true when dealing with
dx...
Thinker
07-21-2003, 12:32 PM
I think in this case it has to do with that DDE. But since I haven't really
worked with DDE I can't suggest what to look for.
Garryt1
07-22-2003, 08:52 AM
I think in this case it has to do with that DDE. But since I haven't really
worked with DDE I can't suggest what to look for.
Thanks for the help guys,
I have cured the problem now!.I moved the dde links into the form load sub and made the integer converted strings global.I also had to put the converted strings into the polygon draw sub and it seems to work ok.
cheers.