473,503 Members | 11,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Loosing memory

Hi,

I have a window program (C#) with 2 buttons, 2 labels and timer running
under Win2K (DotNet 1.1).
On Tick (every 30 mins) it will execute a procedure that reads a number of
files and add records to a database.
Before it finishes SqlDataReader and Connection I are being closed.
There are no global varaibles. All is inside that procedure. The Tick method
has 3 commands - disable timer, execute procedure, enable timer. When
started, the TaskManagers shows that the program uses about 6MB. Each time
the procedure is executed it adds 1.2MB.
Why? I was under impression that all memory used inside procedure is
released after it finishes.

Thanks

MH
Jul 21 '05 #1
3 1592
taskmgr memory display is the memory that the clr allocates based on what it
thinks it is going to need. the more you run something in a given process,
the more mem the clr thinks that process is going to ultimately need. this
taskmgr memory will grow (and that really isn't too much to worry about
unless it never does down)... eventually the gc should run and clean some
things up...freeing up ram.

now on your connections.. are you disposing or just closing? ALWAYS dispose
if you are done with the connection.
"Marius Horak" <so*****@europe.eu> wrote in message
news:u2**************@TK2MSFTNGP10.phx.gbl...
Hi,

I have a window program (C#) with 2 buttons, 2 labels and timer running
under Win2K (DotNet 1.1).
On Tick (every 30 mins) it will execute a procedure that reads a number of
files and add records to a database.
Before it finishes SqlDataReader and Connection I are being closed.
There are no global varaibles. All is inside that procedure. The Tick method has 3 commands - disable timer, execute procedure, enable timer. When
started, the TaskManagers shows that the program uses about 6MB. Each time
the procedure is executed it adds 1.2MB.
Why? I was under impression that all memory used inside procedure is
released after it finishes.

Thanks

MH

Jul 21 '05 #2
Thank you.
I had connection close only. But after 2 days of running the I would expect
GC to clean it up.

MH
Jul 21 '05 #3
Hi Marius

The GC only cleans up managed resources (objects allocated on the heap). Things like database connections, file handles, etc are considered unmanaged, and the GC
doesn't touch them. Patrick is absolutely right; always run the dispose method (if one exists) when you're done with an object. That will take care of any unmanaged resources,
and the GC will do the rest.

-Chris

--------------------
From: "Marius Horak" <so*****@europe.eu>
References: <u2**************@TK2MSFTNGP10.phx.gbl> <#f**************@tk2msftngp13.phx.gbl>
Subject: Re: Loosing memory
Date: Mon, 16 Feb 2004 12:09:37 -0000
Lines: 7
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <uD**************@TK2MSFTNGP09.phx.gbl>
Newsgroups: microsoft.public.dotnet.general
NNTP-Posting-Host: 213.52.140.99
Path: cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.ph x.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.general:124747
X-Tomcat-NG: microsoft.public.dotnet.general

Thank you.
I had connection close only. But after 2 days of running the I would expect
GC to clean it up.

MH

--

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they originated.

Jul 21 '05 #4

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

Similar topics

10
2037
by: Piotr Wolski | last post by:
hello, as always i have a problem:-) i'm using HTML form. User is adding some date to this form and after that i'm generating plot. When plot is generated i can see en empty form and a plot. I...
5
6655
by: Jesper Carstensen | last post by:
We are running an ASP application. That is fairly simple. It selects from one table (15.000 records), and updates into another table. But when we execute the ASP script, it reports the...
0
1746
by: Fabian Kr?ger | last post by:
Hello, I got a weird problem and need your help and ideas... I´ve written an php application which imports data in XML format and writes this data to a MySQL database to have a faster access....
7
7163
by: Billy Jacobs | last post by:
I am having a problem with my session variable being set to Null for no apparent reason. I am declaring it like the following when the user logs in. dim objUserInfo as new clsUserInfo 'Set...
0
1197
by: Victor Marquez | last post by:
Hi All, We have been experiencing problems with StateServer. The service is hanging-up and stops responding further requests. Facts: - There are not events in Application Logs (not...
3
266
by: Marius Horak | last post by:
Hi, I have a window program (C#) with 2 buttons, 2 labels and timer running under Win2K (DotNet 1.1). On Tick (every 30 mins) it will execute a procedure that reads a number of files and add...
15
1795
by: cyndi_r2000 | last post by:
Hi Everyone: I have a web application running on .NET 2.0 under IIS 6.0 and users of this application seem to be loosing their session randomly - we havent been able to identify any pattern,...
2
2146
by: rainjack | last post by:
hi, This function is used to store some data into the stl vector, after store it using push_back, and i will delete the allocated memory using delete , but did it also delete the data i have...
1
1647
by: Owen Richardson | last post by:
I have an asp.net website where i have a quick search facility built into my master page. the search is a web control, with a drop down country box and a list box full of cities. When i select...
0
7364
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7017
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...
0
7470
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5604
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,...
1
5026
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...
0
4696
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...
0
3186
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...
0
3174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1524
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 ...

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.