It's always a good idea to try a small test case that has "the same" behavior.
-----
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>

#define PDE_MAT_SIZE1 40000
#define PDE_MAT_SIZE2 40000

int main()
{
        int *rowptr = malloc((PDE_MAT_SIZE2 + 1) * sizeof(int));
        printf("rowptr=%p  errno=%d\n", rowptr, errno);
        double *nzval = malloc(PDE_MAT_SIZE1 * PDE_MAT_SIZE2 * sizeof(double));
        printf("nzval=%p  errno=%d\n", nzval, errno);
        int *nzcol = malloc(PDE_MAT_SIZE1 * PDE_MAT_SIZE2 * sizeof(int));
        printf("nzcol=%p  errno=%d\n", nzcol, errno);
        if (nzval == 0 || nzcol == 0 || rowptr == 0) {
                fprintf(stderr, "pde_alloc: sparse matrix allocs failed: %s: "
                "nzval = %p, nzcol = %p, rowptr = %p\n", strerror(errno), nzval,
                nzcol, rowptr);
        }
        return 0;
}
-----

It works for me using each of valgrind-3.5.0, valgrind-3.6.0, and today's
valgrind-3.7.0-SVN running under Fedora 14 on x86_64 with 4GB RAM.
$ uname -a
Linux myhost 2.6.35.13-92.fc14.x86_64 #1 SMP Sat May 21 17:26:25 UTC 2011 
x86_64 x86_64 x86_64 GNU/Linux
$ ls -l /lib*/libc.so*
lrwxrwxrwx. 1 root root 12 Feb  8 19:43 /lib64/libc.so.6 -> libc-2.13.so
$ swapon -s
Filename                                Type            Size    Used    Priority
/dev/sda5                               partition       8056560 0       -1
/dev/sdb2                               partition       104416  0       -2
/dev/sda2                               partition       70655996        0       
-3
$ /usr/local/valgrind-3.6.0/bin/valgrind ./a.out
==10622== Memcheck, a memory error detector
==10622== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==10622== Using Valgrind-3.6.0 and LibVEX; rerun with -h for copyright info
==10622== Command: ./a.out
==10622==
   << snip two complaints about 'index' from 'expand_dynamic_string_token' >>
rowptr=0x4c27040  errno=0     ### This allocation was small (160KB).
==10622== Warning: set address range perms: large range [0x393d1040, 
0x3342d9040) (undefined)
nzval=0x393d1040  errno=0
==10622== Warning: set address range perms: large range [0x405a4f040, 
0x5831d3040) (undefined)
nzcol=0x405a4f040  errno=0
==10622==
==10622== HEAP SUMMARY:
==10622==     in use at exit: 19,200,160,004 bytes in 3 blocks
==10622==   total heap usage: 3 allocs, 0 frees, 19,200,160,004 bytes allocated
==10622==
==10622== LEAK SUMMARY:
==10622==    definitely lost: 160,004 bytes in 1 blocks
==10622==    indirectly lost: 0 bytes in 0 blocks
==10622==      possibly lost: 19,200,000,000 bytes in 2 blocks
==10622==    still reachable: 0 bytes in 0 blocks
==10622==         suppressed: 0 bytes in 0 blocks
==10622== Rerun with --leak-check=full to see details of leaked memory
==10622==
==10622== For counts of detected and suppressed errors, rerun with: -v
==10622== Use --track-origins=yes to see where uninitialised values come from
==10622== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 4 from 4)
$
-----

-- 

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a 
definitive record of customers, application performance, security 
threats, fraudulent activity and more. Splunk takes this data and makes 
sense of it. Business sense. IT sense. Common sense.. 
http://p.sf.net/sfu/splunk-d2d-c1
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to