Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Re: Memory Allo...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 11 of 11 Topic 26122 of 26977
Post > Topic >>

Re: Memory Allocation : Static or Dynamic?

by "cr88192" <cr88192@[EMAIL PROTECTED] > May 9, 2008 at 06:14 PM

<swornavidhya.mahadevan@[EMAIL PROTECTED]
> wrote in message 
news:4fb3e23e-d0fb-4b40-a3b9-cd8dfe957dd6@[EMAIL PROTECTED]
> Which allocation (Static / Dynamic) is suitable for the situation when
> we are trying to allocate for a overloaded memory when the memory is
> full and no space to allocate.
> What will happen if both the allocation is impossible.
>

static memory is good for fixed-memory buffers (it will never need to be 
freed or made any larger).

however, note that static memory is also allocated as a part of the app's 
initial process image, so it will either be available, or the app will
fail 
somehow early in app startup (like, an app that as soon as you try to
start 
it, either the OS refuses to load it, it crashes, or the OS crashes).

also note that, because of the fixed nature of static memory, what is 
located there can't be used by elsewhere (it is like putting a big crate
in 
ones' house... one can put things in the crate, but otherwise this space
is 
unusable, and would one rather have a house full of empty space, or filled

with odd-sized crates?...).

one is either limited by all these odd-sized crates, or all of these
crates 
form a big horrible mess...


otherwise, dynamic memory is a lot more adaptable, and I would recommend 
this as a general rule unless one has some specific reason to use large 
static buffers.

after all, if dynamic memory were not useful, why would it have been 
implemented and used in the first place, when static memory is so much 
simpler?...


> Sworna vidhya
 




 11 Posts in Topic:
Memory Allocation : Static or Dynamic?
swornavidhya.mahadevan@[E  2008-05-08 09:58:37 
Re: Memory Allocation : Static or Dynamic?
Antoninus Twink <nospa  2008-05-08 19:48:06 
Re: Memory Allocation : Static or Dynamic?
roberson@[EMAIL PROTECTED  2008-05-08 18:37:36 
Re: Memory Allocation : Static or Dynamic?
Eric Sosman <Eric.Sosm  2008-05-08 15:05:47 
Re: Memory Allocation : Static or Dynamic?
pete <pfiland@[EMAIL P  2008-05-08 17:35:19 
Re: Memory Allocation : Static or Dynamic?
"Malcolm McLean"  2008-05-10 09:20:37 
Re: Memory Allocation : Static or Dynamic?
roberson@[EMAIL PROTECTED  2008-05-08 17:54:14 
Re: Memory Allocation : Static or Dynamic?
Antoninus Twink <nospa  2008-05-08 21:00:32 
Re: Memory Allocation : Static or Dynamic?
Antoninus Twink <nospa  2008-05-08 21:20:49 
Re: Memory Allocation : Static or Dynamic?
Antoninus Twink <nospa  2008-05-08 23:52:02 
Re: Memory Allocation : Static or Dynamic?
"cr88192" <c  2008-05-09 18:14:08 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 3:55:18 CDT 2008.