Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2001-08

Interesting Ansistring issues

7 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

Hey all,
Quick question... are there any known issues with reading an writing lots of ansistring in a record to and from a text file? Reason for the question is because I am trying to do just that... but for some reason after it makes a certain amount of reads and writes it gives me some majorly corrupt memory and gives me a runtime error 216 (GPF)

My first thought was that it was my fault (lots of lines of code in this unit) so i went through it with a fine-tooth comb and every single file i opened is closed, every pointer i allocate is freed, etc. The only thing is, since an Ansistring is a pointer... how do I free that memory? Because none of the pointer routines seem to work on them. (Gives me type mismatches)

Oh yeah.. i also went and downloaded the latest snapshot (1.1) and still no luck.

Any ideas?

TIA - Matt

Peter Vreman
Hey all, Quick question... are there any known issues with reading an writing lots of

ansistring
in a record to and from a text file? Reason for the question is because I am trying to do just that... but for some reason after it makes a certain amount of reads and writes it gives me some majorly corrupt memory and gives me a runtime error 216 (GPF)

My first thought was that it was my fault (lots of lines of code in this unit) so i went

through it with a fine-tooth comb and every single file i opened is closed, every pointer i allocate is freed, etc. The only thing is, since an Ansistring is a pointer... how do I free that memory? Because none of the pointer routines seem to work on them. (Gives me type mismatches)

You can free the memory by assigning an empty string "ansistring:='';"
Oh yeah.. i also went and downloaded the latest snapshot (1.1) and still no luck. Any ideas?

Maybe when you can isolate the problem and mail the required code we can test things. But only from a description that there are possible memoryleaks with ansistrings we can't give any reasonable ideas.

Unknown author
to Unknown author: Quick question... are there any known issues with reading an writing lots of ansistring…
Show quoted text 7 lines
Hey all, Quick question... are there any known issues with reading an writing lots of ansistring in a record to and from a text file? Reason for the question is because I am trying to do just that... but for some reason after it makes a certain amount of reads and writes it gives me some majorly corrupt memory and gives me a runtime error 216 (GPF)

Sebastian Guenther reported something similar.

Can you send me some source code, then I will try to debug it; Probably there is still some conversion error floating around somewhere in the system unit ?

Show quoted text 6 lines
My first thought was that it was my fault (lots of lines of code in this unit) so i went through it with a fine-tooth comb and every single file i opened is closed, every pointer i allocate is freed, etc. The only thing is, since an Ansistring is a pointer... how do I free that memory? Because none of the pointer routines seem to work on them. (Gives me type mismatches) Oh yeah.. i also went and downloaded the latest snapshot (1.1) and still no luck. Any ideas?

This will need some debugging, so some code that shows the problem would be nice. Just writing a lot of output to the screen works fine here.

Michael.

Sebastian Günther
to Unknown author: The former may be the first visible consequence of the latter; When memory corruption…
Show quoted text 13 lines
On Thu, 16 Aug 2001, Sebastian [iso-8859-1] Günther wrote: > wrote: > > > > Sebastian Guenther reported something similar. > > no I have some problems with failing file handle reads or writes, but no > memory corruption actually... The former may be the first visible consequence of the latter; When memory corruption occurs this does not necessarily result in a access violation/segmentation fault.

normally yes, but in my case it's always the same crash position. (and this is the reason for the error code extension - because I want to know why exactly a read or write access failed.)

- Sebastian

Unknown author
to Sebastian Günther: no I have some problems with failing file handle reads or writes, but no memory…
Show quoted text 6 lines
wrote: > > Sebastian Guenther reported something similar. no I have some problems with failing file handle reads or writes, but no memory corruption actually...

The former may be the first visible consequence of the latter; When memory corruption occurs this does not necessarily result in a access violation/segmentation fault.

Michael.

Martin Hankovec

Hello,
my experience with amount of ansistring:

my unit for CSV databases (simple databases,better tables) works fine on 1.0.2 compiler. It can read 62000 lines from text file and split each line to 6 cells. It stores values in dynamically build structure of records, containing ansistrings and pointers. No problem with it.
I didn't try it with the 1.0.4 compiler.

Most errors "216" in this unit I obtained by my own mistakes. In some cases I miss the inicialization, sometimes bad reference. In that huge code it was very hard to find the error :-)

With best regards
Martin H.