Changeset 597 for vendor/current/lib/tdb
- Timestamp:
- Jul 2, 2011, 4:01:14 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/lib/tdb/common/io.c
r414 r597 300 300 { 301 301 struct tdb_record rec; 302 tdb_off_t offset, new_size ;302 tdb_off_t offset, new_size, top_size, map_size; 303 303 304 304 if (tdb_lock(tdb, -1, F_WRLCK) == -1) { … … 310 310 tdb->methods->tdb_oob(tdb, tdb->map_size + 1, 1); 311 311 312 /* always make room for at least 100 more records, and at 313 least 25% more space. Round the database up to a multiple 314 of the page size */ 315 new_size = MAX(tdb->map_size + size*100, tdb->map_size * 1.25); 312 /* limit size in order to avoid using up huge amounts of memory for 313 * in memory tdbs if an oddball huge record creeps in */ 314 if (size > 100 * 1024) { 315 top_size = tdb->map_size + size * 2; 316 } else { 317 top_size = tdb->map_size + size * 100; 318 } 319 320 /* always make room for at least top_size more records, and at 321 least 25% more space. if the DB is smaller than 100MiB, 322 otherwise grow it by 10% only. */ 323 if (tdb->map_size > 100 * 1024 * 1024) { 324 map_size = tdb->map_size * 1.10; 325 } else { 326 map_size = tdb->map_size * 1.25; 327 } 328 329 /* Round the database up to a multiple of the page size */ 330 new_size = MAX(top_size, map_size); 316 331 size = TDB_ALIGN(new_size, tdb->page_size) - tdb->map_size; 317 332
Note:
See TracChangeset
for help on using the changeset viewer.