473,385 Members | 1,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Question on memory used by program

Hi,

I have a VS2005 windows program written in c#.
In this program I have an array list which stores many DataTable's. When I
first run the pogram the arraylist is loaded with datatables. At this point
when the see the memory used by the program in task manager it is 135,654K.
Now when I minimize the application the memory goes down to 1,456K. Again
when I maximize the program and start using different menu options the
memory used remains around 18,000K - 20,000K.

My question is the huge memory utilized by the program initially is because
of GC has not run or I am using lot of memory in my application?
Will the memory used by the application reduce if I change my program from
using an ArrayList of datatable to a single datatable but having data from
all the rows of each datatable in array list?
Will the memory used by the application further reduce if i used an
arraylist and store values as objects of custom classes instead of using
DataTable?

I am using an ArrayList of DataTables because the information from each
datatable is displayed in a DataGridView. At any given time only one
DataTable from the list is displayed based on the user selection. Right now
in the my ArrayList I have 37,000 DataTables and this is not constant and
will increase or decrease.

What would be the best design approach ? Anyone any ideas?

Thanks,
-Asfar
Jun 28 '06 #1
2 1904
Ok, it's normal when you minimize the application, this frees some not in
use memory, because the GC not run all the time only when needed (ex. you
don't have more free memory).
I recommend you, to load the information only in the time the user need
that. In all test I have done, the user not need all the information all the
time, I recommend you to use on demand data load. And no load all the data
at application start.

--
Bela Istok
MVP C#
"Asfar" <as**********@cashmgmt.com> wrote in message
news:uW**************@TK2MSFTNGP04.phx.gbl...
Hi,

I have a VS2005 windows program written in c#.
In this program I have an array list which stores many DataTable's. When I
first run the pogram the arraylist is loaded with datatables. At this
point when the see the memory used by the program in task manager it is
135,654K. Now when I minimize the application the memory goes down to
1,456K. Again when I maximize the program and start using different menu
options the memory used remains around 18,000K - 20,000K.

My question is the huge memory utilized by the program initially is
because of GC has not run or I am using lot of memory in my application?
Will the memory used by the application reduce if I change my program from
using an ArrayList of datatable to a single datatable but having data from
all the rows of each datatable in array list?
Will the memory used by the application further reduce if i used an
arraylist and store values as objects of custom classes instead of using
DataTable?

I am using an ArrayList of DataTables because the information from each
datatable is displayed in a DataGridView. At any given time only one
DataTable from the list is displayed based on the user selection. Right
now in the my ArrayList I have 37,000 DataTables and this is not constant
and will increase or decrease.

What would be the best design approach ? Anyone any ideas?

Thanks,
-Asfar


Jun 28 '06 #2

Asfar wrote:
Hi,

I have a VS2005 windows program written in c#.
In this program I have an array list which stores many DataTable's. When I
first run the pogram the arraylist is loaded with datatables. At this point
when the see the memory used by the program in task manager it is 135,654K.
Now when I minimize the application the memory goes down to 1,456K. Again
when I maximize the program and start using different menu options the
memory used remains around 18,000K - 20,000K.


The task manager "memory" column displays the working set of your
process, which is basically useless to measure the memory footprint of
your app, since the working set is trimmed when the main window is
minimized (as you've experimented), when there is heavy memory pressure
from other processes, etc...

Instead, use perfmon to monitor the "Private Bytes" counter for your
process : this is a much better measurement of your app consumption.
There are also .NET heap counters that will help you. Once you've got a
correct idea of the memory behaviour of your app, come back if you have
more questions

Arnaud
MVP - VC

Jun 28 '06 #3

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

Similar topics

1
by: Milk | last post by:
Hi all, Can anyone help me to do this Question. Coz this is my first time study C++ language and my lecture want me to do this kind of program, i really don't have any ideal, or can send me some...
11
by: Dan Elliott | last post by:
Hello all, I am writing a program which needs to run as quickly as possible, but holds a lot of data in memory (around 1GB for a usual run). Is this too much memory to even consider putting...
2
by: fb | last post by:
Hi everyone. I have the following code. It was a question out of C++ how to program. I get a warning about "possible unreachable code" in the RunCode() function, but I don't see any problem with...
34
by: FMorales | last post by:
-- I didn't notice anything about this specifically -- in the c.l.c. FAQ, nor could i get a strait answere -- from my copy of the C standard. Hopeing someone -- here could shed some light on it...
4
by: Chang Byun | last post by:
I have question about memory allocation. I have a trouble when I run a C program. My C program has several big double pointer(** var) variables to structure data like 4 by 5000000. It is...
18
by: jacob navia | last post by:
In C, we have read-only memory (const), read/write memory (normal data), and write only memory. Let's look at the third one in more detail. Write only memory is a piece of RAM that can only...
73
by: JoeC | last post by:
I am writing a game and I am having a challenge with my combat function. All I want to do is find out how to group pieces that are in the same space. There are two sides and all the units that...
7
by: heddy | last post by:
I have an array of objects. When I use Array.Resize<T>(ref Object,int Newsize); and the newsize is smaller then what the array was previously, are the resources allocated to the objects that are...
4
by: pberent | last post by:
I am trying to run a c# program which loads very large arrays (total of about 1.2GB). I have 2GB of RAM on my machine and looking at task manager it doesnt look like it has all been used. I have...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.