i wrote a program that have a large size array, but the size is change often
(about 3 -4 mins)
the program like that:
public class MemoryArray
{
public float[,,] MM;
public MemoryArray(int Size)
{
MM = new float[Size, 10000, 10000];
}
}
static void Main(string[] args)
{
int[] SizeArray = { 100, 200, 300, 400 };
MemoryArray MA = new MemoryArray(1);
int i=0;
while (true)
{
MA = null; // I try to use it to release memory
GC.Collect();
MA = new MemoryArray(SizeArray[i++%4]; 1 1401
MISS REPLY
I WILL OPEN A NEW THREAD
PLEASE SKIP THIS
THANKS
"macneed" <ma*****@yahoo.com.hk¼¶¼g©ó¶l¥ó·s»D:48******@127.0 .0.1...
>i wrote a program that have a large size array, but the size is change often (about 3 -4 mins)
the program like that:
public class MemoryArray
{
public float[,,] MM;
public MemoryArray(int Size)
{
MM = new float[Size, 10000, 10000];
}
}
static void Main(string[] args)
{
int[] SizeArray = { 100, 200, 300, 400 };
MemoryArray MA = new MemoryArray(1);
int i=0;
while (true)
{
MA = null; // I try to use it to release memory
GC.Collect();
MA = new MemoryArray(SizeArray[i++%4];
.
.
.
}
}
But the program seems can't release memory,
it alway break at below line after running a period of time
MA = new MemoryArray(SizeArray[i++%4];
and return a outofmemoryexception
how can i release a array allocated memory and reset the size of it?
THANKS This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mark Hannon |
last post by:
I am trying to initialize an array only once so it can be seen & used by
any functions that need it. As I understand it, if a variable is
declared by itself outside of any functions, its scope is...
|
by: slack_justyb |
last post by:
Hello,
I'm trying to figure the best way of doing the following.
*I need an array of strings that are globally accessable from within
'arrayhere.h'
*I need that array of strings to not change...
|
by: jut_bit_zx |
last post by:
class A
{
public:
A();
virtual ~A(){}
....
private:
int m_iarray;
}
|
by: arkobose |
last post by:
hey everyone!
i have this little problem. consider the following declaration:
char *array = {"wilson", "string of any size", "etc", "input"};
this is a common data structure used to store...
|
by: Geoff Cox |
last post by:
Hello,
Can I separately declare and initialize a string array? How and where
would I do it in the code below? It was created using Visual C++ 2005
Express Beta 2 ...
In C# I would have
...
|
by: Scirious |
last post by:
People, how can I know how big an object is? I mean, I have an object the
collects data from a stream and when it grows to an especific size I need
to create a new object to continue collecting the...
|
by: toton |
last post by:
Hi,
In C++ when I initialize an array it, also initializes the class that
it contains, which calls the default constructor. However, I want to
initialize the array only (i.e reserve the space) and...
|
by: heng |
last post by:
If the data member of a class is an array, how to initialize?
I tried the following, but it is wrong.
class A
{
public:
int a;
A():a({0,0,0}){}
};
|
by: macneed |
last post by:
i wrote a program that have a large size array, but the size is change often
(about 3 -4 mins)
the program like that:
public class MemoryArray
{
public float MM;
public MemoryArray(int...
|
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...
|
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...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: 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...
| |