Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* memory address space on alpha Linux
@ 2001-01-06 22:00 T. Daniel Crawford
  2001-01-06 22:49 ` Uncle George
  2001-01-06 23:49 ` Richard Henderson
  0 siblings, 2 replies; 8+ messages in thread
From: T. Daniel Crawford @ 2001-01-06 22:00 UTC (permalink / raw)
  To: axp-list

Hi, all,

I'm having trouble with the way the memory allocation system works in C
as implemented under alpha Linux.  Here's some simple code:

------------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
  long int *n, size;

  printf("%d %d %d\n", sizeof(int), sizeof(long int), sizeof(long long
int));

  size = 1;
  n = (long int *) malloc(size * sizeof(int));
  printf("size = %d; n = %ld\n", size, n);

  size = 1000;
  n = (long int *) malloc(size * sizeof(int));
  printf("size = %d; n = %ld\n", size, n);

  size = 100000;
  n = (long int *) malloc(size * sizeof(int));
  printf("size = %d; n = %ld\n", size, n);

  return 0;
}
------------------------------------------------------------------------------

The output from this program using the Compaq C compiler, ccc, is:

4 8 8
size = 1; n = 4832890112
size = 1000; n = 4832890608
size = 100000; n = 2199023427600

Note that I get nearly the same results using GNU C.

Now, if, instead, I run this under Compaq's Tru64 UNIX, I get:

4 8 8
size = 1; n = 5368717568
size = 1000; n = 5368721408
size = 100000; n = 5368765536

For the large-block allocation, on alpha Linux the address is off in the
middle of nowhere (from my perspective) while on alpha Tru64 both the small-
and large-block allocations end up in approximately the same region of
address space.

My questions: (1) I am misinterpreting my results? (2) If not, why does
this happen?

Thanks in advance for any help!

-Daniel

-- 
T. Daniel Crawford                           Department of Chemistry
crawdad@vt.edu                                    Virginia Tech
www.chem.vt.edu/chem-dept/crawford    Voice: 540-231-7760  FAX: 540-231-3255




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2001-01-07 20:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-06 22:00 memory address space on alpha Linux T. Daniel Crawford
2001-01-06 22:49 ` Uncle George
2001-01-06 23:49 ` Richard Henderson
2001-01-07  2:46   ` T. Daniel Crawford
2001-01-07 20:07     ` Richard Henderson
2001-01-07 20:21       ` T. Daniel Crawford
2001-01-07 20:36         ` Greg Lindahl
2001-01-07 20:36     ` Greg Lindahl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox