CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

*** glibc detected *** free(): invalid pointer

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree4Likes
  • 2 Post By wyldckat
  • 1 Post By carowjp
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 28, 2013, 21:53
Unhappy *** glibc detected *** free(): invalid pointer
  #1
Member
 
carowjp's Avatar
 
Jim Carow
Join Date: Apr 2010
Location: Michigan, USA
Posts: 41
Rep Power: 16
carowjp is on a distinguished road
Hello,

I working on a coding a utility, it completes, and when it ends I get this less than graceful exit:

Code:
ExecutionTime = 52.25 s  ClockTime = 54 s

End

*** glibc detected *** spinFoam: free(): invalid pointer: 0x0000000001791200 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7f90da1edb96]
spinFoam(_ZN4Foam14GeometricFieldIdNS_12fvPatchFieldENS_7volMeshEED1Ev+0xb9)[0x411569]
spinFoam[0x40dc78]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7f90da19076d]
spinFoam[0x40df6d]
...
Aborted (core dumped)
Any tips on how to debug this?

thanks,

James
carowjp is offline   Reply With Quote

Old   March 2, 2013, 07:27
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings James,

That's usually due to freeing an object from memory more than once... usually crashes on the second attempt to delete the object.

Also happens if you have two libraries loaded into memory, which manipulate the same object name. Or even worst, two libraries of the same file name (or similar), using identically named classes...

Best regards,
Bruno
hua1015 and Daniel_Khazaei like this.
__________________
wyldckat is offline   Reply With Quote

Old   March 5, 2013, 19:52
Default Thanks Bruno
  #3
Member
 
carowjp's Avatar
 
Jim Carow
Join Date: Apr 2010
Location: Michigan, USA
Posts: 41
Rep Power: 16
carowjp is on a distinguished road
Bruno,

Thanks for the pointers...ha ha.

Jim
wyldckat likes this.
carowjp is offline   Reply With Quote

Old   December 28, 2014, 07:41
Default
  #4
New Member
 
Bahram's Avatar
 
Bahram Haddadi
Join Date: Feb 2014
Location: Vienna, Austria
Posts: 20
Rep Power: 12
Bahram is on a distinguished road
Hi

I'm trying to create a pointer list of matrices by adding following lines to icoFoam (OpenFOAM 2.3.0, Ubuntu 14.04, gcc version: 4.8.2), the code compiles with out error but I get the following run time error, How ever I tried I couldn't find the solution. Please help:
Code:
       ...
        Info<< "Time = " << runTime.timeName() << nl << endl;

        #include "readPISOControls.H"
        #include "CourantNo.H"
       
        //*******new lines********
        PtrList<lduMatrix> PEqns(1);

        PEqns.set
        (
            0,
            new fvScalarMatrix
            (fvm::ddt(p))
        );
        //********end new lines********

        fvVectorMatrix UEqn
        (
            fvm::ddt(U)
          + fvm::div(phi, U)
          - fvm::laplacian(nu, U)
        );

        solve(UEqn == -fvc::grad(p));
       ...
error:

Code:
Create time

Create mesh for time = 0

Reading transportProperties

Reading field p

Reading field U

Reading/calculating face flux field phi


Starting time loop

Time = 0.005

Courant Number mean: 0 max: 0
smoothSolver:  Solving for Ux, Initial residual = 1, Final residual = 8.90511e-06, No Iterations 19
smoothSolver:  Solving for Uy, Initial residual = 0, Final residual = 0, No Iterations 0
DICPCG:  Solving for p, Initial residual = 1, Final residual = 7.55423e-07, No Iterations 35
time step continuity errors : sum local = 5.03808e-09, global = -7.94093e-21, cumulative = -7.94093e-21
DICPCG:  Solving for p, Initial residual = 0.523588, Final residual = 9.72371e-07, No Iterations 34
time step continuity errors : sum local = 1.07766e-08, global = 2.00426e-19, cumulative = 1.92485e-19
ExecutionTime = 0.01 s  ClockTime = 0 s

*** Error in `icoFoam': free(): invalid pointer: 0x0000000001931250 ***
Aborted (core dumped)
any help is appreciated.

Merry Christmas

Bests
Bahram
Bahram is offline   Reply With Quote

Old   January 7, 2015, 05:41
Default
  #5
New Member
 
Bahram's Avatar
 
Bahram Haddadi
Join Date: Feb 2014
Location: Vienna, Austria
Posts: 20
Rep Power: 12
Bahram is on a distinguished road
any ideas?!
Bahram is offline   Reply With Quote

Old   January 11, 2015, 17:26
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Bahram,

Quote:
Originally Posted by Bahram View Post
any ideas?!
I and plenty others on the forum have got a lot of ideas. The limitation is in fact having the necessary time to write and/or test those ideas.
If you had spent the time to lay out the ideas you've tried out, it would have been easier to try and point out what you might be doing wrong. Since you didn't, it took me around 25 minutes to test, research and write this post with the answers. That might not look like a lot of time, but now multiply that by the number of posts I have on my to-do list I'm not the only one who answers questions here on the forum, but to me it seems we are too few to be able to answer to everyone...


Anyway, when it comes to OpenFOAM, it's best to search for similar/identical situations in its source code. I've used the following command:
Code:
find $FOAM_SOLVERS -name "*.[CH]" -type f | xargs grep PtrList
For more ideas: http://openfoamwiki.net/index.php/In...with_the_Shell

And then I looked into the file "multiphase/compressibleMultiphaseInterFoam/pEqn.H". It seems that there are two things you're doing wrong:
  1. "new" is not the best solution, due to the complexity of the classes that OpenFOAM is using.
  2. "lduMatrix" is a bad class for a pointer that you tell it to store "fvScalarMatrix".
For me, the following worked just fine:
Code:
          PtrList<fvScalarMatrix> PEqns(1);
          PEqns.set
          (
              0,
              (fvm::ddt(p)).ptr()
          );
Best regards,
Bruno
Daniel_Khazaei likes this.
__________________
wyldckat is offline   Reply With Quote

Old   January 12, 2015, 02:05
Default
  #7
New Member
 
Bahram's Avatar
 
Bahram Haddadi
Join Date: Feb 2014
Location: Vienna, Austria
Posts: 20
Rep Power: 12
Bahram is on a distinguished road
Dear Bruno

Thanks a lot for your nice reply and also all the time which you spend for answering our questions . I'll give it a try.

Bests
Bahram
Bahram is offline   Reply With Quote

Old   November 14, 2017, 12:36
Default
  #8
New Member
 
Graham
Join Date: Feb 2016
Posts: 13
Rep Power: 10
benham is on a distinguished road
Hi there,

I am getting a similar error when I try to run the addSwirlAndRotation function, from the Turbomachinery course (see below). The error output begins:

*** Error in `addSwirlAndRotation': free(): invalid pointer: 0x00007ffe48afc1c8 ***

I managed to compile the function without any errors but I get this error when I execute it. (running OF3.0 on ubuntu)

I am not sure how this relates to previous comments by wyldckat or Bahram.

Any help would be much appreciated.

Best wishes,
Graham


Turbomachinery course:

http://openfoamwiki.net/index.php/Si...nical_diffuser
benham is offline   Reply With Quote

Old   December 5, 2017, 04:02
Default
  #9
New Member
 
Graham
Join Date: Feb 2016
Posts: 13
Rep Power: 10
benham is on a distinguished road
Never mind, I have figured it out now. I updated to OF5.0 and now it works.
benham is offline   Reply With Quote

Old   March 8, 2018, 00:12
Default
  #10
Senior Member
 
Elham
Join Date: Oct 2009
Posts: 184
Rep Power: 16
Elham is on a distinguished road
Quote:
Originally Posted by benham View Post
Never mind, I have figured it out now. I updated to OF5.0 and now it works.
Dear Benham,

Which version of ubuntu are you using? I have similar problem with OpenFOAM-2.3.1. My solver worked well that this error happened when I tried to do some fixing with paraView. I have Ubuntu-16.04 and I am wondering if I can get rid of the error by upgrading my OpenFOAM?

Regards,

Elham
Elham is offline   Reply With Quote

Old   March 12, 2018, 04:41
Default
  #11
New Member
 
Graham
Join Date: Feb 2016
Posts: 13
Rep Power: 10
benham is on a distinguished road
Hi there,

My Ubuntu version is 16.04.

I think it should work if you upgrade to OF 5.0

Best wishes,
Graham
benham is offline   Reply With Quote

Reply

Tags
glibc pointer backtrace

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenFOAM install on Ubuntu Natty 11.04 bkubicek OpenFOAM 13 May 26, 2011 05:48
Error glibc detected munmap_chunk invalid pointer sega OpenFOAM Running, Solving & CFD 6 June 3, 2008 18:30
Phase locked average in run time panara OpenFOAM 2 February 20, 2008 14:37
user subroutine error CFDUSER CFX 2 December 9, 2006 06:31
user defined function cfduser CFX 0 April 29, 2006 10:58


All times are GMT -4. The time now is 01:07.