Forum > LCL

Tdbf is raising exception "out of memory"

(1/3) > >>

penpen:
Hi,
when I connect a .dbf database file and try to read a memo field that is empty I always get an outofmemory exception because it just keeps reading "forever".

This is the command I use:

MyString := dbf2.FieldByName('MemoField').AsString;

How can I check if the field is empty, without reading it ?
dbf2.FieldByName('MemoField').isNull doesnt work unfortunately.

Hope you can help

penpen

Handoko:
I cannot reproduce the issue. I've just made a test and S := MyDbf.FieldByName('MemoField').AsString; worked correctly even the field is empty. So I'm sure the bug you got was not on the line you showed us.

I've been using TDbf for years on a small program I wrote and use almost everyday, so far it's working good.

Please show us the whole source code so we can inspect it and tell you where you did it wrong.

penpen:
Thank you for your input.

I figured the problem is with the database. I cant share that with you, but it has some Memo Fields where dbf lib just wont stop reading till the "out of memory" exception is raised. It also does that when I call  bytes := MyDbf.FieldByName('MemoField').AsBytes

Some other empty memo fields in the same .dbf file however return NIL.

PS:
I can kind of workaround that using
try
 S := MyDbf.FieldByName('MemoField').AsString;
except
end;
But once these outofmemory memo fields come the program slows down dramatically because its reading many MB of nothing.

Is there a decent way I can debug this ?

sstvmaster:
Did you tried a Third party software to test your dbf?

You can check using this:

- https://sourceforge.net/projects/gtkdbfeditor/files/gtkdbfeditor/gtkdbfeditor-1.0.4/
- http://www.alexnolan.net/software/dbf.htm

Maybe this editor can read the memo field

Cyrax:

--- Quote from: penpen on March 14, 2019, 08:56:35 pm ---Thank you for your input.

I figured the problem is with the database. I cant share that with you, but it has some Memo Fields where dbf lib just wont stop reading till the "out of memory" exception is raised. It also does that when I call  bytes := MyDbf.FieldByName('MemoField').AsBytes

Some other empty memo fields in the same .dbf file however return NIL.

PS:
I can kind of workaround that using
try
 S := MyDbf.FieldByName('MemoField').AsString;
except
end;
But once these outofmemory memo fields come the program slows down dramatically because its reading many MB of nothing.

Is there a decent way I can debug this ?

--- End quote ---

You need to rebuild whole FPC suite with debug info options enabled : -gw2 -godwarfsets -godwarfmethodclassprefix -gl -O-

Navigation

[0] Message Index

[#] Next page

Go to full version