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!

Memo field still BLOATING ? No

Status
Not open for further replies.

NasibKalsi

Programmer
Jan 8, 2004
417
CA
Hello all

I found by accident that when I replace Memo field in a table it does not bloat anymore. I tried many replace statements but the size remain the same. I want to compress my *.scx forms so that compiler will produle smaller .exe file. It turned out that when the table is open in exclusive mode, it does not bloat. But if it is open in shared mode the table will bloat with each replace statement and requires pack to bring back to the actual size.
Code:
* No Bloating (code below)
* filename - any dbf file with at least one memo field in it
* bigfile.dbf - any file on your pc
use filename in 0 alias workspace1 exclusive
select workspace1
replace memofield with filetostr("bigfile.dbf")
dir filename.fpt
* At this point chek the file size
replace memofield with filetostr("bigfile.dbf")
dir filename.fpt
* the file size remains the same
* now try the same 6 statement above, without the reserve word 'exclusive'
* you will see that the file will bloat when you issue the replace statement

i hope, it may be helpful to someone.

my best

nasib
 
It's your observation, that bloat occurs at all, if replacing with the same value / same length value, that makes me wonder why that would be the case at all!

As VFP allocates memory in the fpt in multiples of Blocksize chunks, no matter how Blocksize is set in the fpt, wrriting the same size value should work without bloat.

More precise: If writing a new value that still fits into the allocated blocks, bloat should not occur. Eg having blocksize 512 (default) and having a memo value with length 1000 bytes this would mean 2 allocated blocks of size 1024 bytes and values ranging from length 0 to 1024 could fit into the same file blocks.

So it seems, VFP does only reuse already allocated blocks of the fpt in exclusive mode.

Bye, Olaf.
 
It did bloat with the VFP7 yet, if memory still serves. I remember running PACK MEMO every time before APPENDing or INSERTing new records to a table with FTP size over 1.5 GB to prevent that misleading "Not enough disk space" eror message.

Regards,

Ilya
 
Craigber:

Somehow, I still see this bloating when in shared mode. I do not know how fox allocates the memory for fpt files. It should be as Olaf expressed.

Regards

nasib
 
You'll still see bloating in shared mode by the very nature of shared mode.

To PACK MEMO you need exclusive use. In exclusive use, VFP can do what it normally does during pack memo. It cannot do that in shared mode because it doesn't have exclusive use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top