473,385 Members | 1,356 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.

Array/Variable Disposal

I have a program that uses multiple arrays and the memory useage is
huge. After a proceedure ends is there a good way to shrink down an
array's size. The same for variables.
Nov 20 '05 #1
2 1879
"Peter" <pe***@mclinn.com> schrieb
I have a program that uses multiple arrays and the memory useage
is huge. After a proceedure ends is there a good way to shrink down
an array's size. The same for variables.


The array is only stored in a local variable? Then the variable runs out of
scope, which means the reference to the array is deleted and the array can
be collected by the garbage collector. It destroys the object and frees
memory if it's time:

http://msdn.microsoft.com/library/en...asp?frame=true
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
* pe***@mclinn.com (Peter) scripsit:
I have a program that uses multiple arrays and the memory useage is
huge. After a proceedure ends is there a good way to shrink down an
array's size. The same for variables.


If the array is declared inside the procedure, like:

\\\
Public Sub Foo()
Dim astr() As String
...
End Sub
///

.... it's ready to be destroyed by the Garbage Collector when the
procedure is left. Notice that there is no deterministic cleanup in
..NET, so task manager may show wrong results of what amount of memory is
really used by your app's "living" objects.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3

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

Similar topics

58
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
21
by: E. Robert Tisdale | last post by:
> cat vararray.c #include <stdio.h> int Print3DArray(int n3, int n2, int a, int n1) { int i = 0; for(i = 0; i < n1; ++i) { int j = 0; for(j = 0; j < n2; ++j) { int k = 0; for(k = 0; k < n3;...
31
by: RS | last post by:
Hi, Looking to see if the following construct is valid: typedef struct { int foo; char bar; } foobar; Basically, the idea is to have the structure above point to a message buffer that has...
11
by: truckaxle | last post by:
I am trying to pass a slice from a larger 2-dimensional array to a function that will work on a smaller region of the array space. The code below is a distillation of what I am trying to...
32
by: Joe Rattz | last post by:
Hmmm, I wrote the following code. I want an array of bools and I want to intialize them to false. bool bits = new bool; foreach(bool bit in bits) { bit = false; } The compiler complains...
5
by: BobTheHacker | last post by:
Does anybody no the max length of data a session variable can contain ?
3
by: Chris | last post by:
I am just wondering if I did this the best way possible. I needed to add a double boarder around a label box. So I made a pen in the class, and do the drawing of the rectangles in the onpaint...
13
by: Umesh | last post by:
How can I delete one or more elements of an array. let a={1,2,3,4,5} Now i want to send the third element '3' to an array b and remove the element from a. How can I do it?
3
by: adiel_g | last post by:
Hello everyone, I am trying to move a field name to a variable in vb.net. For example, first I retrieve the record from the database and save its value: .... userGroup =...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.