Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CURSOR Experiencing Memo Bloat
Message
 
 
To
15/07/2006 12:24:09
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
01136610
Message ID:
01136698
Views:
12
Jim,

The difference between excl/shared, is that every memo replace in shared mode causes a new memo block allocation, even if the content would fit within the currently allocated block. In exclusive if the memo will fit within the current space it'll reuse the block.

This code shows the effect:
clear

lcBlockSize = "0"
testblocksize()

lcBlockSize = "5"
testblocksize()

function testblocksize()
lcMode = "exclusive"
testit()

lcMode = "shared"
testit()
return

function testit()

set blocksize to &lcBlockSize

create table memo1 ( m1 m )
append blank
use in memo1

? "Mode:", lcMode
? "Blocksize:", lcBlockSize
? "Make the memo larger"

for i = 1 to 3
   adir( laFile, "memo1.fpt" )
   ? "Before:", laFile[2]
   use memo1 &lcMode
   replace m1 with m1 + " "
   use
   adir( laFile, "memo1.fpt" )
   ?? " After:", laFile[2]
endfor

? "Make the memo smaller"

for i = 1 to 3
   adir( laFile, "memo1.fpt" )
   ? "Before:", laFile[2]
   use memo1 &lcMode
   replace m1 with left( m1, len( m1 ) - 1 )
   use
   adir( laFile, "memo1.fpt" )
   ?? " After:", laFile[2]
endfor
In shared mode the size goes up with every operation, except the last smaller operation because at that point the memo is empty, so the memo pointer in the dbf goes to null the fpt size is not affected. In exclusive mode the file size only increases when the currently allocated block is exceeded.

>No, I don't think so (memo bloat 'expected').
>VFP handles memo fields differently depending on if the table is exclusive or not.
>Many of us who tried tests to reduce memo bloat got caught be this little fact, things working nicely in exclusive tables changing characteristics when tables were SHARED.
>
>Now technically an exclusively USEd cursor would still be exclusive if USEd AGAIN. As I said, I'm reaching in this 'theory', but it may defy VFPs internal logic that a table used twice is 'exclusive' for both instances.
>
>I dunno.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform