Afficher un message
Vieux 18/10/2007, 17h16   #4
GameboyHippo
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Allocationg memory: contigously ?

On Oct 18, 12:04 pm, farb...@gmail.com wrote:
> On Oct 18, 8:55 pm, horacius....@gmail.com wrote:
>
> > Hi,

>
> > if I allocate memory in a simple program like

>
> > int* pint1=new[1000];
> > int* pint2=new[1000];
> > int* pint3=new[1000];

>
> > then memory is allocated on the heap. My question is if this three
> > "memory fragmetns" are allocated contigously. And if not, what could I
> > do to allocate them contigously.

>
> > Thanks

>
> hey
> im sure sbout that memory may not be contiguous....since it is done
> dynamically...rather never..coz u can take that probability as
> 1:trillion.
> and about the thing im not 140% sure is that nthng can be done about
> it...only thing u can do is that u can join them by linking stacks..
> well thats all i know frm my school... ...im still studying..pl tell
> me if there;s a mistake


y do people talk lik thiz. I mean seriously people. Is it that hard
to communicate using complete words? To me, it topples your
credibility.

Okay, now for something that really matters. Will the data be
contigously? Maybe. Maybe not. How to make them contigous: Here's
what I would do.

int* pint=new[3000];
int* pint1 = pint;
int* pint2 = pint + 1000;
int* pint3 = pint + 2000;

  Réponse avec citation
 
Page generated in 0,04752 seconds with 9 queries