GPFault problem


I wonder if anyone can help me I am going potty here.

I developed a standalone Delphi application using Delphi 1.02, Paradox
tables and Crystal Reports. I am running under Windows 95.

I am doing some heavy processing at one point in my program, which I
do not let the user interrupt and display a "progress form" with the
percentage of the processing done. Behind the scenes, I am reading
information in from 7 different tables and updating three, so I have
10 tables open at the same time. Unfortunately I do need them all.
(Normalised tables, multi-lingual application, etc.). I also create
some stringlists and do some processing on them.

The tables I need most often I create TTables and TDatasources for
globally for the whole application at load-time. Other TTables and
TDatasources I create at run-time as and when I need them. Only one
table and datasource sits on a form as a component. But as I mentioned
before, I need about 10 tables open at the same time. Also, in this
process, I create and initialise some string lists as and when I need

Once the process is finished, I destroy the dynamically created tables
with MyTable.Free, MyDatasource.Free and the string lists with

The whole process runs perfectly several times, but after about the
4th (or 5th or 6th, etc) it falls over with GPFault.

I started to put in Try Except blocks in an attempt to catch where
the GPFault occurs. I got to a stage now when I have a Try Except on
almost every line in my code and still, I cannot fathom why and how it
falls over. The GPFault does turn up reliably, but at different times
(i.e. it varies how many times I can execute the heavy processing bit
without it falling over) and at different places in my code (but all
towards the end of the processing). Sometime it falls over when I set
the progress forms gauge to 100%, yet the form with the gauge is
still there. At other times it falls over when I am freeing the tables
and datasources. Yet at other times it falls over after all that but
before it gets to the next stage of showing the form with the result.

I do realise that the most common cause of GPFault is attempting to
access an uninitialized pointer or object and I can assure you I do
not have any, I went through my code with a fine toothcombe.
Furthermore, the process runs 3-4 times perfectly!!.

In my Try Except blocks I am always checking for EOutOfResources,
EOutOfMemory and EGPFault. It always falls over on EGPFault, never on
the others. But just in case I increased the stack and the heap
I tried running the program without the "progress form", i.e. with
only the cursor as an hourglass.
I tried creating all TTables and TDatasources once globally as opposed
to as and when I need them.
I tried checking whether the database has finished posting the
previous updates before I post the next one (I heard that this might
be a problem).
. I tried hundreds of things, to no avail.

Delphis help says that the other possibilities for GPFault are:
1 Loading invalid values into segment registers
2 Accessing memory beyond a segment's limit
3 Writing to read-only code segments
But I wouldnt know how to check these or what to do about them if
they do occur.

Anyone has any ideas what might be wrong?? Please, please help me!!!

Thanks awfully.

Either post to this group or e-mail me:

(P.S. Sorry about the lengthy description of the problem)