What a frustating business this can be sometimes.  I spent more than an hour
building the case for the message below, testing scenarios, looking for
coding errors, etc.  Now, the crash has returned even with the Create_GEO
and Destroy_GEO outside the loop.  I know it worked fine once, but not now.

Therefore, don't spend much effort thinking about this one until I have
gathered some better information.

Regards,
DLH

-----Original Message-----
From: David Humphrey [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 20, 2001 10:56 AM
To: '[EMAIL PROTECTED]'
Subject: RE: [gxnet]: Floating Point Crash in Destroy_GEO


Before I get off into posting the offending code, I have another clue.
Perhaps this is documented somewhere.  Is it a capital offense to create and
destroy a session more than once during the execution of a program?

Here's why I ask.  I have a utility program that is converting grids from
one format to another.  Oasis is one of those destinations.  Here's a
schematic of the C++ code:

loop over grids to be converted {
        read input data
        switch on type of output grid {
                case a:...
                case b:...
                case geosoft:
                        create a session object
                        use the session object to write a geosoft grid
                        destroy the session object
                case z:...
        }
}

The program dies the second time it enters the "use the session object to
write a geosoft grid" and tries to allocate a VV with CreateExt_VV (see code
below).  Note the printf's.  The first time through, everything works fine.
The second time through, it crashes and I never get the message
"BGI_Grid::writeGrosoft:  hcol = ...".  If I move the create and destroy
outside the loop so that the session object is created and destroyed only
once, the problem does not arise.


/*--------------------------------------------------------------------*/
void BGI_Grid::writeGeosoft ( void *pGeo, char *fileName) {             //
write a grid in native Geosoft binary format
/*--------------------------------------------------------------------*/
        printf ("BGI_Grid::writeGeosoft:  pGeo = %d\n",pGeo);
        GX_HANDLE hGrd =
CreateNewFile_IMG(pGeo,_l(GS_DOUBLE),_l(1),&nxs,&nys,fileName);
        printf ("BGI_Grid::writeGeosoft:  hGrd = %d\n",hGrd);
        SetInfo_IMG(pGeo,&hGrd,&xinc,&yinc,&xmin,&ymin,&rotation);
        printf ("BGI_Grid::writeGeosoft:  returned from SetInfo_IMG\n");

        printf ("BGI_Grid::writeGeosoft:  Grid parameters:  %d %d %f %f %f
%f\n",nxs,nys,xmin,ymin,xinc,yinc);

        GX_HANDLE hCol = CreateExt_VV(pGeo,_l(GS_DOUBLE),&nys);
        printf ("BGI_Grid::writeGeosoft:  hCol = %d\n",hCol);
        for ( long nx=0; nx<nxs; nx++ ) {
                for ( long ny=0; ny<nys; ny++ ) {
                        double zval = getval(nx,ny);
                        if ( zval == null ) zval = -1.e32;
                        SetReal_VV(pGeo,&hCol,&ny,&zval);
                }
                printf ("BGI_Grid.writeGeosoft:  about to write column
#%d...",nx);
                WriteX_IMG(pGeo,&hGrd,&nx,_l(0),&nys,&hCol);
                printf ("BGI_Grid.writeGeosoft:  success\n");
        }

        Destroy_VV(pGeo,&hCol);
        Destroy_IMG(pGeo,&hGrd);
}


Therefore, one of three things

1.  One shouldn't create and destroy session objects more than once per
execution of a program.
2.  There's a bug somewhere, presumeable in the CreateExt_VV code, that
keeps one from doing this.
3.  There's somethings else in my code that is corrupting memory.

In any case, I have either solved the problem or developed a workaround, so
I'm happy...for the moment.

Regards,
DLH

-----Original Message-----
From: Stephen Cheesman [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 19, 2001 9:16 AM
To: '[EMAIL PROTECTED]'
Cc: Tech (Geosoft Corporate)
Subject: RE: [gxnet]: Floating Point Crash in Destroy_GEO


David:

At a quick glance, we can't give you a reason or work-around for the aborts
you are getting in Destroy_GEO. It does not appear to be a true
Floating-Point error. It may be a problem with with linking between DLLs in
different versions, and it may be necessary to re-install one or more Oasis
montaj components. I will forward this to our technical support. 

Any additional information (original code, files, etc) is always valuable in
tracing down aborts.

Stephen Cheesman
Geosoft Inc.

-----Original Message-----
From: David Humphrey [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 18, 2001 11:49 AM
To: '[EMAIL PROTECTED]'
Subject: [gxnet]: Floating Point Crash in Destroy_GEO


I'm working on a C++ program that accesses Oasis montaj functions through
the GX Developer facilities.  This program creates a session object with
Create_GEO, creates a new grid file, writes values to it with the _VV and
_IMG functions, and then tries to close the session object with Destroy_GEO.
The contents of the grid are correct.  Can anyone give me a clue why
Destroy_GEO is crashing with a "Floating Point Crash"?  The contents of the
abort.log file appears below.

Regards,
David L. Humphrey
Manager, Software Development
Bell Geospace, Inc





GEOSOFT PROGRAM TERMINATION

Please FAX to Geosoft Tech Support at (Canada 416) 369 9599.
         or E-Mail to [EMAIL PROTECTED] .

Also note what the program was doing at the time of failure.
------------------------------------------------------------
  CURRENT COMPUTER PROFILE

         Operating System: Microsoft Windows NT 4.0 (Build 1381)
                 CPU Type: Intel Pentium
           Number of CPUs: 2
       Memory Utilization: 0%
    Total Physical Memory:     255.42 MB
Available Physical Memory:     121.70 MB
     Total Virtual Memory:    2047.88 MB
 Available Virtual Memory:    2026.81 MB
      Maximum Paging Size:     493.99 MB
      Current Paging Size:     326.77 MB
------------------------------------------------------------

  PROGRAM DETAILS

            Date and Time: Wed Apr 18 10:36:24 2001

             Program Name: (Unknown)
                  Version: Version 5.0.6 (KZ)
------------------------------------------------------------

Exception

GEOCORE : The thread tried to read from or write to a virtual address
for which it does not have appropriate access.



Call Stack


[Thread 0] (Current)

pBindFunc_GXX    //depot/rel/geo/5.0.6_rel/src/class/gx/gx.c#2  {3348}


[Thread 1]

SMPThread        //depot/rel/geo/5.0.6_rel/src/class/sys/smpsys.c#1     {93}


[Thread 2]

SMPThread        //depot/rel/geo/5.0.6_rel/src/class/sys/smpsys.c#1     {93}


Error Stack
(Error)


========= Floating Point Crash =========


========================================

------------- CPU Context ------------

ContextFlags  : 1048817
Dr0    : 0
Dr1    : 0
Dr2    : 0
Dr3    : 0
Dr6    : 0
Dr7    : 0

SegGs  : 0
SegFs  : 131
SegEs  : 50
SegDs  : 50

Edi    : 277225358
Esi    : 15251971
Ebx    : 0
Edx    : 96
Ecx    : 16
Eax    : 15252035

Ebp    : 4068104
Eip    : 8341131
SegCs  : 177
EFlags : 1056864
Esp    : 2215753
SegSs  : 50

ControlWord   : 4294910199
StatusWord    : 4294902786
TagWord       : 4294967295
ErrorOffset   : 7242437
ErrorSelector : 1085604017
DataOffset    : 278288655
DataSelector  : 4294901810
Cr0NpxState   : 0




_______________________________________________________
More mailing list info http://www.geosoft.com/support/listserv/index.html
List Archive http://www.mail-archive.com/gxnet@lists.geosoft.com
_______________________________________________________
More mailing list info http://www.geosoft.com/support/listserv/index.html
List Archive http://www.mail-archive.com/gxnet@lists.geosoft.com
_______________________________________________________
More mailing list info http://www.geosoft.com/support/listserv/index.html
List Archive http://www.mail-archive.com/gxnet@lists.geosoft.com
_______________________________________________________
More mailing list info http://www.geosoft.com/support/listserv/index.html
List Archive http://www.mail-archive.com/gxnet@lists.geosoft.com

Reply via email to