good morning!!!!

Skip to content
Snippets Groups Projects
Commit e16a7ef6 authored by Jeffrey Wilcke's avatar Jeffrey Wilcke
Browse files

core/vm: capped int pool

parent a816e756
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,8 @@ import "math/big"
var checkVal = big.NewInt(-42)
const poolLimit = 256
// intPool is a pool of big integers that
// can be reused for all big.Int operations.
type intPool struct {
......@@ -37,6 +39,10 @@ func (p *intPool) get() *big.Int {
return new(big.Int)
}
func (p *intPool) put(is ...*big.Int) {
if len(p.pool.data) > poolLimit {
return
}
for _, i := range is {
// verifyPool is a build flag. Pool verification makes sure the integrity
// of the integer pool by comparing values to a default value.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment