QUE1: If I have declared a really large aaray inside a function, would it be automatically deallocated on exit the scope of the function??

QUE2:While using mpz_class in GMP is the memory automatically deallocated after exiting the scope i.e. are the appropriate destructors for giving the memory back to O.S there or I have to manually do it ?

QUE3: I would like to utilise all the four cores of my intel quad-core and assign 1 ploynomial per processor, what should I use... would fork() do the job???

1) yes, but beware of stack overflow if the array is too large.

2) probably, but some operating systems may not deallocate it.

3) I don't know.

For question # 1

(a) Is allocated with new or (b)just something like int a[1000000];

option a, use delete [].
option b, its destructor is called, and deletes it automatically. But
as Ancient dragon pointed out, there could be stack overflow.

I think that question 1 is pretty much resolved ... for question 2 I am using linux ubuntu jaunty, it would be nice to know for sure that it is deallocated(somebody help)....also, I am assuming that I can use about 2GB of the available 4GB RAM, am I overlooking something, what is the size of the stack???..do I have to consider L1 or L2 cache... I will need a 10000x10000 array in the program how do i know that stack wont overflow...thx
ABhishek

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.