Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
dcc4adfc
Commit
dcc4adfc
authored
Jul 05, 2019
by
Guillaume Ballet
Committed by
Péter Szilágyi
Jul 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/geth: wrong memory size sanitizing on OpenBSD (#19793)
parent
d9c75cd1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
main.go
cmd/geth/main.go
+10
-5
sync_bloom.go
trie/sync_bloom.go
+1
-1
No files found.
cmd/geth/main.go
View file @
dcc4adfc
...
@@ -21,6 +21,7 @@ import (
...
@@ -21,6 +21,7 @@ import (
"fmt"
"fmt"
"math"
"math"
"os"
"os"
"runtime"
godebug
"runtime/debug"
godebug
"runtime/debug"
"sort"
"sort"
"strconv"
"strconv"
...
@@ -256,11 +257,15 @@ func init() {
...
@@ -256,11 +257,15 @@ func init() {
}
}
// Cap the cache allowance and tune the garbage collector
// Cap the cache allowance and tune the garbage collector
var
mem
gosigar
.
Mem
var
mem
gosigar
.
Mem
if
err
:=
mem
.
Get
();
err
==
nil
{
// Workaround until OpenBSD support lands into gosigar
allowance
:=
int
(
mem
.
Total
/
1024
/
1024
/
3
)
// Check https://github.com/elastic/gosigar#supported-platforms
if
cache
:=
ctx
.
GlobalInt
(
utils
.
CacheFlag
.
Name
);
cache
>
allowance
{
if
runtime
.
GOOS
!=
"openbsd"
{
log
.
Warn
(
"Sanitizing cache to Go's GC limits"
,
"provided"
,
cache
,
"updated"
,
allowance
)
if
err
:=
mem
.
Get
();
err
==
nil
{
ctx
.
GlobalSet
(
utils
.
CacheFlag
.
Name
,
strconv
.
Itoa
(
allowance
))
allowance
:=
int
(
mem
.
Total
/
1024
/
1024
/
3
)
if
cache
:=
ctx
.
GlobalInt
(
utils
.
CacheFlag
.
Name
);
cache
>
allowance
{
log
.
Warn
(
"Sanitizing cache to Go's GC limits"
,
"provided"
,
cache
,
"updated"
,
allowance
)
ctx
.
GlobalSet
(
utils
.
CacheFlag
.
Name
,
strconv
.
Itoa
(
allowance
))
}
}
}
}
}
// Ensure Go's GC ignores the database cache for trigger percentage
// Ensure Go's GC ignores the database cache for trigger percentage
...
...
trie/sync_bloom.go
View file @
dcc4adfc
...
@@ -70,7 +70,7 @@ func NewSyncBloom(memory uint64, database ethdb.Iteratee) *SyncBloom {
...
@@ -70,7 +70,7 @@ func NewSyncBloom(memory uint64, database ethdb.Iteratee) *SyncBloom {
// Create the bloom filter to track known trie nodes
// Create the bloom filter to track known trie nodes
bloom
,
err
:=
bloomfilter
.
New
(
memory
*
1024
*
1024
*
8
,
3
)
bloom
,
err
:=
bloomfilter
.
New
(
memory
*
1024
*
1024
*
8
,
3
)
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
fmt
.
Sprintf
(
"failed to create bloom: %v"
,
err
))
// Can't happen, here for sanity
panic
(
fmt
.
Sprintf
(
"failed to create bloom: %v"
,
err
))
}
}
log
.
Info
(
"Allocated fast sync bloom"
,
"size"
,
common
.
StorageSize
(
memory
*
1024
*
1024
))
log
.
Info
(
"Allocated fast sync bloom"
,
"size"
,
common
.
StorageSize
(
memory
*
1024
*
1024
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment