473,545 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Timer Memory

wg
Can someone help me with this. I have a application in which a timer runs
all the time. I set some flags in side the timer so there is nothing inside
to cause a problem. However if I run the app, it continually grows in
memory. If I leave it long enough it will eventually grow out of control How
can I deal with this?

Thanks

wg
Dec 2 '05 #1
4 1294
WG,

I probably don't understand you. Do you mean that your program is running
all the time inside one method.

That is one of the exceptions where I have seen that you than have to call
the Garbage Collector yourself time by time.

Cor
Dec 2 '05 #2
wg,

Can you be more specific? Better yet, can you post a short, but
complete program that demonstrates the problem?

What flags are you setting? What timer are you using? What else are
you doing inside in the timer event and elsewhere in the program?

Brian

wg wrote:
Can someone help me with this. I have a application in which a timer runs
all the time. I set some flags in side the timer so there is nothing inside
to cause a problem. However if I run the app, it continually grows in
memory. If I leave it long enough it will eventually grow out of control How
can I deal with this?

Thanks

wg


Dec 2 '05 #3
wg
Here is a mockup of my applicaiton. Notice that I have commented out the
thread that I was starting and the problem still occurs. If the progarm is
run, I can watch it in the task manager and it continues to grow in memory.
The flags are being set by a serial port routine. I have tried a system
timer and form timer, same result. I attempted the System.GC.Colle ct at the
end of the Tick Event, same result. No matter what I have tried, same
result.
Public Class Form1

Inherits System.Windows. Forms.Form

Dim counter As Int16

Dim TxFlag As Boolean

Dim RxFlag As Boolean

Dim RxCommFlag As Boolean

Dim TxCommFlag As Boolean


Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Timer1.Enabled = True

End Sub

Private Sub Timer1_Tick(ByV al sender As System.Object, ByVal e As
System.EventArg s) Handles Timer1.Tick

'Dim Tx As New Thread(AddressO f sendcomm)

If TxFlag And RxCommFlag Then

TxFlag = False

RxCommFlag = False

counter = 0

End If

If Not TxFlag And Not RxCommFlag Then

TxFlag = True

'Tx.Start()

End If

If TxFlag And Not RxCommFlag Then

counter = counter + 1

End If

If counter > 200 Then

TxFlag = False

RxCommFlag = False

counter = 0

End If

End Sub

"Brian Gideon" <br*********@ya hoo.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
wg,

Can you be more specific? Better yet, can you post a short, but
complete program that demonstrates the problem?

What flags are you setting? What timer are you using? What else are
you doing inside in the timer event and elsewhere in the program?

Brian

wg wrote:
Can someone help me with this. I have a application in which a timer runs
all the time. I set some flags in side the timer so there is nothing
inside
to cause a problem. However if I run the app, it continually grows in
memory. If I leave it long enough it will eventually grow out of control
How
can I deal with this?

Thanks

wg

Dec 3 '05 #4
Well, I certainly don't see anything obvious from the code you've
posted. How much memory growth are we talking about and in what time
frame? Do you have an estimate in MB/hour or equivalent units? Have
you eliminated the serial communications and other aspects of the
application as possibilities?

Brian

wg wrote:
Here is a mockup of my applicaiton. Notice that I have commented out the
thread that I was starting and the problem still occurs. If the progarm is
run, I can watch it in the task manager and it continues to grow in memory.
The flags are being set by a serial port routine. I have tried a system
timer and form timer, same result. I attempted the System.GC.Colle ct at the
end of the Tick Event, same result. No matter what I have tried, same
result.
Public Class Form1

Inherits System.Windows. Forms.Form

Dim counter As Int16

Dim TxFlag As Boolean

Dim RxFlag As Boolean

Dim RxCommFlag As Boolean

Dim TxCommFlag As Boolean


Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Timer1.Enabled = True

End Sub

Private Sub Timer1_Tick(ByV al sender As System.Object, ByVal e As
System.EventArg s) Handles Timer1.Tick

'Dim Tx As New Thread(AddressO f sendcomm)

If TxFlag And RxCommFlag Then

TxFlag = False

RxCommFlag = False

counter = 0

End If

If Not TxFlag And Not RxCommFlag Then

TxFlag = True

'Tx.Start()

End If

If TxFlag And Not RxCommFlag Then

counter = counter + 1

End If

If counter > 200 Then

TxFlag = False

RxCommFlag = False

counter = 0

End If

End Sub


Dec 3 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2121
by: Richard P | last post by:
I need some help on timers. My app is asp.net 1.1 website running in a shared hosting environment with a third-party service provider. I currently request and cache 20 - 40 remote RSS feeds. When a user requests the page, the app first tries to retrieve a feed from cache, if the feed has expired, it goes off and request the file from the web....
2
2076
by: Rajesh Abraham | last post by:
I have a timer in my Windows Service project and I am trying to do some processing on the tick event of the timer but this event does not seesms to be raised. Below is some code segment. Any Idea? Thanks, Rajesh Abraham -----Code Below------
1
2049
by: yaktipper | last post by:
VS.NET 2002, framework 1.0 I wrote a very simple program to display the RGB value and x,y mouse position at the cursor on a 50ms timer. I noticed a memory leak of 8K per timer event. The leak still occurs after commenting out the code and simple having one line in the timer: private void timerMouseColor_Tick(object sender,...
4
2804
by: hazz | last post by:
given namespace WindowsService1 { public class Service1 : System.ServiceProcess.ServiceBase......... private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { ArrayList myAL = new ArrayList(); CustomClass objCont = new ControllerClass; CustomClass objInfo = new InfoClass;
4
1795
by: Peter Oliphant | last post by:
I'd like to be able to destroy a Timer in it's own event handler. That is, within it's tick handler I'd like to delete the Timer itself (e.g., for one-shot timers). Is this possible? In general, can a class instance destroy itself via one of it's own methods?
2
4033
by: jajalc | last post by:
Hi all, WE have a windows service using .net and which uses a System.Timers.Timer..all the of code works fine..... but after a extended period of time the timer just stops firing the elasped event. the elasped event is fired every 2 sec and the code which is in the elasped event is multithreaded. This only happens if the service runs...
9
2637
by: archana | last post by:
Hi all, I want to know about interval of timer. I am using timer in windows service.I head somewhere that when i set interval property of timer while setting interval, restart time of Pc is consider. My question is if i am using timer in my windows service, is there any place where interval related information like interval set used...
16
3232
by: Peter Oliphant | last post by:
Note that although this involves SAPI, it is more a question about Timers and event handlers. I wrote a Speech Recognize handler (SAPI), and put some code in it to enable a Timer. It would not do it. If I bring this same code outside this event handler, it works just fine. Is this normal?
9
3107
by: =?Utf-8?B?TWlrZTk5MDA=?= | last post by:
Hello, I am wondering if it is a good idea to use GC.Collect() in a timer. For example, timer is fired every 5 minutes and calls GC.Collect(). In our server app the memory goes to 600MB and stays there. The memory hardly goes down. When I disconnect the client and the connect it again the memory could reclaim to 400MB. But it could go...
0
7409
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7436
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5981
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5341
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4958
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1897
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
715
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.