0

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???

3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by abhishek4563
0

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.

0

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.

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.