glibc detected *** ./run.out: munmap_chunk(): invalid pointer:
  Home FAQ Contact Sign in
comp.lang.fortran only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.fortran Profile…
 Up
glibc detected *** ./run.out: munmap_chunk(): invalid pointer:         


Author: rudra
Date: Apr 3, 2008 09:53

Dear friends, few days back , i asked your help on a "gfortran
problem"

subroutine
coefficient(istart,lorbit,nrec,nsite,nmax,nn,cmat,dmat)
implicit none
integer:: i,j,k,q,orb,rcs,site,itr,sorbit,strstat,torbit
integer::nn,lorbit,nrec...
Show full article (4.22Kb)
17 Comments
Re: glibc detected *** ./run.out: munmap_chunk(): invalid pointer:         


Author: nospam
Date: Apr 3, 2008 10:24

rudra gmail.com> wrote:
> subroutine
> coefficient(istart,lorbit,nrec,nsite,nmax,nn,cmat,dmat)
...
> real(8),dimension(:,:),allocatable::h1,h2,h3
> integer,dimension(:,:),allocatable::npos
....
> when i am directly assigneing the value of h1,h2, h3 and npos,
> the code is working fine with ifort but fails on other compiler. but
> if I am trying to use dynamic allocation, its coming out with error:

At least we have some actual code to look at this time. We don't have
enough of the code to show the problem... but fortunately, we have
enough to make a good guess from.
Show full article (2.95Kb)
no comments
Re: glibc detected *** ./run.out: munmap_chunk(): invalid pointer:         


Author: Greg Lindahl
Date: Apr 3, 2008 10:23

In article <47fea16c-b9d1-4b29-85d4-789ef42f6e74@i36g2000prf.googlegroups.com>,
rudra gmail.com> wrote:
>Dear friends, few days back , i asked your help on a "gfortran
>problem"

Right. The answer this time is the same as last time. Try turning on
bounds checking, and if that doesn't reveal your error, run it under
valgrind.

-- greg
no comments
Re: glibc detected *** ./run.out: munmap_chunk(): invalid pointer:         


Author: Dick Hendrickson
Date: Apr 3, 2008 14:33

Richard Maine wrote:
> rudra gmail.com> wrote:
>
>> subroutine
>> coefficient(istart,lorbit,nrec,nsite,nmax,nn,cmat,dmat)
> ...
>> real(8),dimension(:,:),allocatable::h1,h2,h3
>> integer,dimension(:,:),allocatable::npos
> ....
>> when i am directly assigneing the value of h1,h2, h3 and npos,
>> the code is working fine with ifort but fails on other compiler. but
>> if I am trying to use dynamic allocation, its coming out with error:
>
> At least we have some actual code to look at this time. We don't have
> enough of the code to show the problem... but fortunately, we have
> enough to make a good guess from.
>
> In general, you really need to show more of the relevant code, In this
> case, the code that calls this subroutine is very relevant... in fact,
> that's where the whole problem probably is... but you haven't shown it. ...
Show full article (3.29Kb)
no comments
Re: glibc detected *** ./run.out: munmap_chunk(): invalid pointer:         


Author: nospam
Date: Apr 3, 2008 16:50

Dick Hendrickson att.net> wrote:
> Richard Maine wrote:
>> Allocatable dummy arguments are one of the many things that require an
>> explicit interface.
> But, h1, h2, h3, npos, and a few more, are not dummy arguments,

Oops. So I see. I must have crossed my eyes funny when looking earlier.
In my own code, I like to clearly separate the declarations of dummy
arguments from those of "purely" local things. It helps keep my easily
confused eyes from getting such things wrong.
> they're automatic arrays.

Well, they aren't (they are allocatable). But some other arrays are, so
that's at least plausible. Though the "invalid pointer" message does
make me lean more towards Greg's theory of exceeding array bounds.

--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
no comments
Re: glibc detected *** ./run.out: munmap_chunk(): invalid pointer:         


Author: Dick Hendrickson
Date: Apr 3, 2008 19:37

Richard Maine wrote:
> Dick Hendrickson att.net> wrote:
>
>> Richard Maine wrote:
>
>>> Allocatable dummy arguments are one of the many things that require an
>>> explicit interface.
>
>> But, h1, h2, h3, npos, and a few more, are not dummy arguments,
>
> Oops. So I see. I must have crossed my eyes funny when looking earlier.
> In my own code, I like to clearly separate the declarations of dummy
> arguments from those of "purely" local things. It helps keep my easily
> confused eyes from getting such things wrong.
>
>> they're automatic arrays.
>
> Well, they aren't (they are allocatable). But some other arrays are, so
> that's at least plausible. Though the "invalid pointer" message does
> make me lean more towards Greg's theory of exceeding array bounds. ...
Show full article (1.21Kb)
no comments
Re: glibc detected *** ./run.out: munmap_chunk(): invalid pointer:         


Author: Les
Date: Apr 4, 2008 01:31

"rudra" gmail.com> wrote in message
news:47fea16c-b9d1-4b29-85d4-789ef42f6e74@i36g2000prf.googlegroups.com...
> Dear friends, few days back , i asked your help on a "gfortran
> problem"

> allocate(h1(nmax,lorbit),h2(nmax,lorbit),h3(nmax,lorbit))

In addition to what others have written. I recommend allocate one array at a
time and use the error status to verify success, especially if the problem
domain is large. Then if an allocate fails you may gracefully terminate the
program and can even inform the user why. Or choose an alternative option.
( I saw code some time ago which used a file to store data if it was unable
to allocate sufficient memory. It may have made that part of the code run
slower but at least it didn't just die.)

.
> 08048000-080c5000 r-xp 00000000 00:1c 11714571 /matsc/students/Rudra/
> Recursion/Real/run.out
> 080c5000-080ca000 rwxp 0007c000 00:1c 11714571 /matsc/students/Rudra/
> Recursion/Real/run.out
Show full article (1.18Kb)
no comments
Re: glibc detected *** ./run.out: munmap_chunk(): invalid pointer:         


Author: rudra
Date: Apr 4, 2008 05:59

This is my full code; however, it reads a very large file nn-
bcc.dat(102719 ) and some other file like pot and struct which is not
writable here as u can understand. if someone(as Richard Maine asked)
to send me those file , i am ready to send that to them ...but in that
case i need their email so that i can attach the file. looking fwd
for your support

!FILE CMAT
-0.254762493737499
-1.29898640827846
-1.29898640827846
-1.29898640827846
0.563874755720254
0.563874755720254
0.563874755720254
0.563874755720254
0.563874755720254
Show full article (7.19Kb)
1 Comment
Re: glibc detected *** ./run.out: munmap_chunk(): invalid pointer:         


Author: Les
Date: Apr 4, 2008 07:43

OK I don't see any recursion going on.
But :
> real(8),dimension(9)::dmat,cmat
>
> call coefficient(istart,lorbit,nrec,nsite,nmax,nn,cmat,dmat)
> end program main
>
> subroutine coefficient(istart,lorbit,nrec,nsite,nmax,nn)

There's a problem straight away : it won't compile.
You are calling with 8 arguments but the subroutine only expects 6
- however it might be a typo, if you were trying to post a code snippet!
>! writing results ro file
> do q=1,nrec
> write(22,*) q,alpha(q),beta(q)
> end do

I haven't studied the algorithm but
the bounds of alpha are 1 to nrec+1
and those of beta are 0 to nrec+1
but the do loop is 1 to nrec
Show full article (0.95Kb)
no comments
Re: glibc detected *** ./run.out: munmap_chunk(): invalid pointer:         


Author: rudra
Date: Apr 4, 2008 21:04

>> call coefficient(istart,lorbit,nrec,nsite,nmax,nn,cmat,dmat)
>> end program main
>
>> subroutine coefficient(istart,lorbit,nrec,nsite,nmax,nn)
>
This is just a typo. in main, the right thing is
call coefficient(istart,lorbit,nrec,nsite,nmax,nn)
no comments

RELATED THREADS
SubjectArticles qty Group
#36884 [Com]: *** glibc detected *** double free or corruption (!prev): 0x0000000000b4acc0 **mailing.www.php-dev ·
1 2