Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

clean memory

Status
Not open for further replies.

marabozu

Programmer
Jan 3, 2001
36
US
The following code works fine...
Text1.LinkMode = 0
Text1.LinkTopic = "EXCEL|Sheet1"
For d = 0 To 8
Text1.LinkItem = "R1C" & d
Text1.LinkMode = 2
Text1.LinkRequest
Requested(d) = Text1.Text
Text1.LinkMode = 0
Next d
...But this one, each time the Tex1.LinkRequest is being executed the memory increses, and I can't clean the memory...

Text1.LinkMode = 0
Text1.LinkTopic = "REUTER|IDN"
For d = 0 To 8
Text1.LinkItem = "PTCO.IN, " & d
Text1.LinkMode = 2
Text1.LinkRequest
Requested(d) = Text1.Text
Text1.LinkMode = 0
Next d

This code runs every 15 minutes and after a few cicles my memory is completly full! Does anyone can help me on this one?
thank you
 
I can't say that I am familiar with "REUTER|IDN" but I really don't think that is the problem. In most cases when this method is used the problem is because the called object is still sitting in memory. Even your call used in the first method probably has left something out there that is not being cleaned up. You might try setting the object to nothing and see if that helps. When you use the LinkTopic is is calling a DLL for the object in the first case it called the Excel Dll and it is possible that DLL is clean. The problem could be with the DLL being called for REUTER.

Sorry I could not be of much more help.

Thomas
 
tcoffey,
thank you for you attention.
I'm not sure if the problem is in the Reuters dll file, because if I use DDE protocol in a Excel macro (the code is very similar to VB) the program don't increse any memory. The main diference is that in VB for Excel I can terminate a conversation using Application.DDETerminate method.
Example:
For d = 0 To 8
channelNumber = Application.DDEInitiate( _
app:="REUTER", _
topic:="IDN")
Application.DDEExecute channelNumber, "PTCO.IN, " & d
Application.DDETerminate channelNumber
Next d

This code doesn't fill the memory! I can't understand...
Thank you anyway
 
it doesnt fill the memory in your last example because the the DDETerminate method closes the DDE session, thereby releasing the memory in use by that session. There should be a way to close the link in VB each time. You really shouldn't be using DDE in any new programs, although this reuter .dll is probably a DDE server that you need to use so you don't have any choice. Look for a way to close the dde conversatation after your updates, that is why you are leaking memory. Ruairi

Could your manufacturing facility benefit from real time process monitoring? Would you like your employees to be able to see up to the minute goal and actual production?
For innovative, low cost solutions check out my website.
 
I can't find the DDETerminate method for VB. I will use excel :(
Thanx anyway you both for your colaboration
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top