Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AS400/Delphi program causing Pointer Error

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
US
In my program I am connecting to an AS400 through ODBC, and everything SEEMS to be ok. When the data is changed in my Delphi program the table in the AS400 is updated, but when looking into the Active Jobs, my users have pages of this error:

The pointer parameter passed to free or realloc is not valid

when looking into the details of the error:
Message: The pointer parameter passed to free or realloc
is not
valid.

Cause: The pointer parameter passed to free or realloc was not valid. This caused your function call to fail.

Recovery: Correct the invalid pointer parameter being passed to free or realloc.

Technical description: The value of the pointer passed to free or realloc is X'8000000000000000C5679C355C005910'.

The only thing that changes is the value of the pointer. I think I have figured out that the problem is occurring when the following lines are executed:
Code:
If frmPostpone.ModalResult = mrOK then
  begin
    With JMSData.qryJurorSearch do
      begin
      Edit;
      FieldValues['TERMDATE'] := ConvertDate(frmPostpone.postponedate);
      Post;
      end;
   lblTERMDATE.Caption := dateformat(JMSData.qryJurorSearch.FieldByName('TERMDATE').AsString);
   FormLetter('PP');
  end;
Has anyone experienced anything similar? I'm afraid I'm going to have to re-code all the portions that use the 'POST' method as shown above.

Thanks for any insight into this "problem"

Leslie
landrews@metrocourt.state.nm.us

There are 10 types of people in the world -
those who understand binary
and
those who don't!
 
Here is what I found out!!!

Error C2M1212:

This message is sent when the free() or realloc() functions are called using an invalid pointer. If the function determines that the pointer passed to it does not point to memory that was allocated with the malloc() function, it will return without freeing the memory at the pointed offset and send the message. The only way to prevent the messages from being sent is to fix the application code to properly manage its memory allocation.

Unfortunately, I don't know how to fix the application to manage memory allocation, because until today I didn't know that I was doing it!!

Any help will be appreciated!

Thanks,
Leslie
 
I don't think that YOU are doing anything wrong.

Although you haven't explicitly stated it, the error message is being produced on the AS400. This means that the AS400 software is allocating memory and assigning it to a pointer. At some point, the pointer is being corrupted and the AS400 is then trying to free the memory.

If you can, I would suggest you try to repeat the ODBC calls but this time from Visual Basic. That way, you should be able to remove Delphi from the list of suspects.

But you will still have the problem. Which DBMS system is being used on the AS400?

Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top