Sponsored Content
Top Forums Programming FORTRAN: double free or corruption Post 302807297 by Marce on Tuesday 14th of May 2013 12:48:11 PM
Old 05-14-2013
FORTRAN: double free or corruption

Hello.
I'm looking for a quite "interesting" bug I'm using fortran 90, compiler gfortran and the main idea is for every time step I build a bin structure for search contact between particles, for this at the begining
Code:
TYPE :: circle_index
			INTEGER(kind = 4) :: ind_p
			TYPE(circle_index), POINTER :: p
END TYPE
		
TYPE(circle_index), DIMENSION(:), POINTER :: Bins(:)
TYPE(circle_index), DIMENSION(:), POINTER :: Bins_Tail(:)
TYPE(circle_index),POINTER :: headB

And the next part it's called almost every time step.
I compute rows and colums variables for allocate memory

Code:
ALLOCATE(Bins(rows*columns),Bins_Tail(rows*columns))

Then I do the search for finally
Code:
DO pos = 1, rows*columns
	headB => Bins(pos)%p
	DO
		IF(.NOT. ASSOCIATED(headB)) EXIT
		ptr_index => headB%p
		DEALLOCATE(headB)
		headB => ptr_index
	END DO
END DO
DEALLOCATE(Bins, Bins_Tail)

The search is ok, but I get some of these errors
*** glibc detected *** double free or corruption (out)
*** glibc detected *** free(): invalid next size (normal)

And it's wierd for me because if I'm deallocating in the wrong way I expect the error at the beginig but it does not. The error just appear more after, am I doing it wrong?
I already use -fbounds-check but does not work and is really dificult debug step by step because the simulation is very long, so any ideas?

Does anybody have an idea what is happening here? Have you seen something similar yet? What could i still try?

Greetings & thank you,
Marce.
 

7 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

file corruption

Hi, All of a sudden I landed in a strange problem. I was working with my C source code in vi editor. I did a wq! and when reopened, the file is full of "data".. I mean the text contents are gone!!. I believe this is a file corruption. I have tried the -r option with vi, but no success. ... (5 Replies)
Discussion started by: shibz
5 Replies

2. Programming

*** glibc detected *** double free or corruption: 0x40236ff4 ***

when i try to use the class i wrote, i either get this: *** glibc detected *** double free or corruption: 0x40236ff4 *** and the proccess exits with an error code of 0; or it segfaults. could someone look at my header file (with imp.) to give me some insight as to why its not working? ... (19 Replies)
Discussion started by: norsk hedensk
19 Replies

3. Programming

Pointer to a struct (with pointers) *** glibc detected *** double free

I am using a structure defined as follows struct gene_square { double *x; double *y; };I have class, with a member function which is a pointer of this type: gene_square* m_Genes;I am allocating memory in the constructors like this: m_Genes = new gene_square; for (ii=0;... (1 Reply)
Discussion started by: jatoo
1 Replies

4. Solaris

Data corruption

I have a solaris 5.6 on which oracle is installed. we have an alert file alert_net1.log now whenever any datacorruption happens we get the file id and block id in the above file. through this file and block id , we try to find out which table is corrupted and then try to... (1 Reply)
Discussion started by: asalman.qazi
1 Replies

5. Solaris

MountPoint / is 8% with 899.49MB free crossing threshold of 10% free

Hi, I have a problem one of the server file system cross the limitation MountPoint / is 8% with 899.49MB free crossing threshold of 10% free out put please help how to resolve this dev/vx/dsk/bootdg/rootvol 9.8G 8.8G 956M 91% / /devices ... (3 Replies)
Discussion started by: sriniva0
3 Replies

6. UNIX for Advanced & Expert Users

File System corruption

Hi, While a tar file was created, the file system got full and there was no message on the tar failure. Then the system was shut down and the administrator says because the file system was full the shut down procedure corrupted the file system. I'm wondering, unix should have given some... (2 Replies)
Discussion started by: manivanm
2 Replies

7. Programming

C++ glibc detected double free or corruption(!prev) using shared library

Currently I test a shared library vendor provided in linux , the following is the simple source : #include <iostream> using namespace std; extern int test1(); extern int test2(); int main() { cout << "hello world" << endl ; return 0 ; cout << "Test 1" << endl; ... (6 Replies)
Discussion started by: barfatchen
6 Replies
menu_format(3CURSES)					     Curses Library Functions					      menu_format(3CURSES)

NAME
menu_format, set_menu_format - set and get maximum numbers of rows and columns in menus SYNOPSIS
cc [ flag... ] file... -lmenu -lcurses [ library... ] #include <menu.h> int set_menu_format(MENU *menu, int rows, int cols); void menu_format(MENU *menu, int *rows, int *cols); DESCRIPTION
set_menu_format() sets the maximum number of rows and columns of items that may be displayed at one time on a menu. If the menu contains more items than can be displayed at once, the menu will be scrollable. menu_format() returns the maximum number of rows and columns that may be displayed at one time on menu. rows and cols are pointers to the variables used to return these values. RETURN VALUES
set_menu_format() returns one of the following: E_OK The routine returned successfully. E_SYSTEM_ERROR System error. E_BAD_ARGUMENT An incorrect argument was passed to the routine. E_POSTED The menu is already posted. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
curses(3CURSES), menus(3CURSES), attributes(5) NOTES
The header <menu.h> automatically includes the headers <eti.h> and <curses.h>. SunOS 5.10 31 Dec 1996 menu_format(3CURSES)
All times are GMT -4. The time now is 01:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy