Skip to content

wrong pool unmarshal slize #92

Open

Description

wrong pool unmarshal size.

my proto file:

// protoc  --go_out=. --plugin protoc-gen-go="/Users/jie.yang05/go/bin/protoc-gen-go"  --go-vtproto_out=.  --plugin protoc-gen-go-vtproto="/Users/jie.yang05/go/bin/protoc-gen-go-vtproto"  --go-vtproto_opt=features=marshal+unmarshal+size+pool ./lineentry.proto
syntax = "proto3";

package index;

option go_package="./proto";

import "github.com/planetscale/vtprotobuf/vtproto/ext.proto";

message lineEntries {
  option (vtproto.mempool) = true; // Enable memory pooling
  repeated lineEntry lineEntries = 1;
}

message lineEntry {
  uint64 address = 1;
  uint32 line = 2;
  uint32 file = 3;
}

comand

yangjie05-mac:index jie.yang05$ protoc  --go_out=. --plugin protoc-gen-go="/Users/jie.yang05/go/bin/protoc-gen-go"  --go-vtproto_out=.  --plugin protoc-gen-go-vtproto="/Users/jie.yang05/go/bin/protoc-gen-go-vtproto"   -I /Users/jie.yang05/go/pkg/mod/github.com/planetscale/vtprotobuf\@v0.4.0/include -I ./ ./lineentry.proto

generate code:

func (m *LineEntries) ResetVT() {
	for _, mm := range m.LineEntries {
		mm.ResetVT()
	}
	m.Reset()
}

func (m *LineEntries) ReturnToVTPool() {
	if m != nil {
		m.ResetVT()
		vtprotoPool_LineEntries.Put(m)
	}
}

generate code have wrong ResetVT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions