Re: Huge memory allocation



Richard Tobin a écrit :
In article <Y_ydnUikEK8JW9zbnZ2dnUVZ_vmqnZ2d@xxxxxxxxxxx>,
Eric Sosman <esosman@xxxxxxxxxxxxxxxxxxx> wrote:


char *m = malloc(50*1024);


Woops! In this formulation, sizeof(int) -- or, rather,
"rangeof(int)" -- *does* come into play.


Oops! I edited it from 50000 to 50*1024 at the last moment, without
considering the consequences.

-- Richard
That's why I recommended
calloc(50,1024) in my other post

That should (if calloc has no bugs) do the trick
regardless of the sizeof(int)
.



Relevant Pages