mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
slightly safer record usage of compiler hack
This commit is contained in:
parent
0ed5ef7b06
commit
d71afc52d7
@ -180,14 +180,17 @@ namespace mongo {
|
|||||||
bool Record::MemoryTrackingEnabled = true;
|
bool Record::MemoryTrackingEnabled = true;
|
||||||
|
|
||||||
|
|
||||||
int __record_touch_dummy = 1; // this is used to make sure the compiler doesn't get too smart on us
|
volatile int __record_touch_dummy = 1; // this is used to make sure the compiler doesn't get too smart on us
|
||||||
void Record::touch( bool entireRecrd ) {
|
void Record::touch( bool entireRecrd ) {
|
||||||
|
|
||||||
if ( lengthWithHeaders > HeaderSize ) { // this also makes sure lengthWithHeaders is in memory
|
if ( lengthWithHeaders > HeaderSize ) { // this also makes sure lengthWithHeaders is in memory
|
||||||
char * addr = data;
|
char * addr = data;
|
||||||
char * end = data + netLength();
|
char * end = data + netLength();
|
||||||
for ( ; addr <= end ; addr += 2048 )
|
for ( ; addr <= end ; addr += 2048 ) {
|
||||||
__record_touch_dummy += addr[0];
|
__record_touch_dummy += addr[0];
|
||||||
|
if ( ! entireRecrd )
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user