~bkerensa/ubuntu/raring/valgrind/merge-from-deb

« back to all changes in this revision

Viewing changes to memcheck/tests/memalign_test.c

  • Committer: Bazaar Package Importer
  • Author(s): Andrés Roldán
  • Date: 2008-06-13 02:31:40 UTC
  • mto: (1.4.1 upstream) (2.2.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: james.westby@ubuntu.com-20080613023140-iwk33rz9rhvfkr96
Import upstream version 3.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
#include <stdlib.h>
3
3
#include <stdio.h>
 
4
#include <unistd.h>
 
5
#include <assert.h>
4
6
 
5
7
int main ( void )
6
8
{
7
9
  void* a[10];
8
10
  int i;
 
11
  unsigned long pszB = sysconf(_SC_PAGE_SIZE);
 
12
  assert(sizeof(long) == sizeof(void*));
 
13
  assert(pszB == 4096 || pszB == 65536);
 
14
 
9
15
  for (i = 0; i < 10; i++) {
10
16
    a[i] = valloc(11111 * (i+1));
 
17
    /* check valloc really is returning page-aligned memory */
 
18
    assert( (((unsigned long)(a[i])) % pszB) == 0 );
11
19
    //    printf("I acquire %p\n", a[i]);
12
20
  }
13
21
  for (i = 0; i < 10; i++) {