Sfoglia il codice sorgente

goprotobuf: Remove uses of runtime.MemStats.

R=r
CC=golang-dev
http://codereview.appspot.com/5645075
David Symonds 14 anni fa
parent
commit
e434b7516f
2 ha cambiato i file con 0 aggiunte e 10 eliminazioni
  1. 0 5
      proto/decode.go
  2. 0 5
      proto/encode.go

+ 0 - 5
proto/decode.go

@@ -41,7 +41,6 @@ import (
 	"io"
 	"os"
 	"reflect"
-	"runtime"
 	"unsafe"
 )
 
@@ -315,8 +314,6 @@ func (p *Buffer) Unmarshal(pb interface{}) error {
 		return err
 	}
 
-	mstat := runtime.MemStats.Mallocs
-
 	typ, base, err := getbase(pb)
 	if err != nil {
 		return err
@@ -324,8 +321,6 @@ func (p *Buffer) Unmarshal(pb interface{}) error {
 
 	err = p.unmarshalType(typ, false, base)
 
-	mstat = runtime.MemStats.Mallocs - mstat
-	stats.Dmalloc += mstat
 	stats.Decode++
 
 	return err

+ 0 - 5
proto/encode.go

@@ -38,7 +38,6 @@ package proto
 import (
 	"errors"
 	"reflect"
-	"runtime"
 	"unsafe"
 )
 
@@ -199,15 +198,11 @@ func (p *Buffer) Marshal(pb interface{}) error {
 		return nil
 	}
 
-	mstat := runtime.MemStats.Mallocs
-
 	t, b, err := getbase(pb)
 	if err == nil {
 		err = p.enc_struct(t.Elem(), b)
 	}
 
-	mstat = runtime.MemStats.Mallocs - mstat
-	stats.Emalloc += mstat
 	stats.Encode++
 
 	return err