mirror of
https://github.com/corda/corda.git
synced 2024-12-28 16:58:55 +00:00
specify a more conservative initial capacity in initNextGen{1,2}()
This commit is contained in:
parent
39bbcc03eb
commit
137fdcb69e
@ -39,6 +39,12 @@ min(unsigned a, unsigned b)
|
|||||||
return (a < b ? a : b);
|
return (a < b ? a : b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline unsigned
|
||||||
|
avg(unsigned a, unsigned b)
|
||||||
|
{
|
||||||
|
return (a + b) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
inline unsigned
|
inline unsigned
|
||||||
pad(unsigned n)
|
pad(unsigned n)
|
||||||
{
|
{
|
||||||
|
@ -285,7 +285,7 @@ class Segment {
|
|||||||
|
|
||||||
if (p == 0) {
|
if (p == 0) {
|
||||||
if (capacity > minimum) {
|
if (capacity > minimum) {
|
||||||
capacity = minimum + ((capacity - minimum) / 2);
|
capacity = avg(minimum, capacity);
|
||||||
} else {
|
} else {
|
||||||
abort(s->context);
|
abort(s->context);
|
||||||
}
|
}
|
||||||
@ -597,7 +597,7 @@ void
|
|||||||
initNextGen1(Context* c)
|
initNextGen1(Context* c)
|
||||||
{
|
{
|
||||||
unsigned minimum = MinimumGen1SizeInBytes / BytesPerWord;
|
unsigned minimum = MinimumGen1SizeInBytes / BytesPerWord;
|
||||||
unsigned desired = max(minimum, nextPowerOfTwo(c->gen1.position()));
|
unsigned desired = max(minimum, avg(c->gen1.position(), c->gen1.capacity()));
|
||||||
|
|
||||||
new (&(c->nextAgeMap)) Segment::Map
|
new (&(c->nextAgeMap)) Segment::Map
|
||||||
(&(c->nextGen1), log(TenureThreshold), 1, 0, false);
|
(&(c->nextGen1), log(TenureThreshold), 1, 0, false);
|
||||||
@ -634,7 +634,7 @@ void
|
|||||||
initNextGen2(Context* c)
|
initNextGen2(Context* c)
|
||||||
{
|
{
|
||||||
unsigned minimum = MinimumGen2SizeInBytes / BytesPerWord;
|
unsigned minimum = MinimumGen2SizeInBytes / BytesPerWord;
|
||||||
unsigned desired = max(minimum, nextPowerOfTwo(c->gen2.position()));
|
unsigned desired = max(minimum, avg(c->gen2.position(), c->gen2.capacity()));
|
||||||
|
|
||||||
new (&(c->nextPointerMap)) Segment::Map(&(c->nextGen2));
|
new (&(c->nextPointerMap)) Segment::Map(&(c->nextGen2));
|
||||||
new (&(c->nextPageMap)) Segment::Map
|
new (&(c->nextPageMap)) Segment::Map
|
||||||
|
Loading…
Reference in New Issue
Block a user