Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mobile/bind: local reference table overflow (max=512) #14346

Closed
ghost opened this issue Feb 16, 2016 · 1 comment
Closed

x/mobile/bind: local reference table overflow (max=512) #14346

ghost opened this issue Feb 16, 2016 · 1 comment

Comments

@ghost
Copy link

ghost commented Feb 16, 2016

The existing implementation has memory leaks on two local variables
that are not deleted after use.
Android app will crash after this issue.

sample code:
Go side:
package client
import "time"

var GEventHandler StockPriceUpdateEevent

type StockPricePushClient struct {
}

type StockPriceUpdateEevent interface {
PriceUpdate(foo int64)
}

func (m *StockPricePushClient) StartUpdate() {
go func() {
    for {
        time.After(time.Millisecond * 100)
        if GEventHandler != nil {
            GEventHandler.PriceUpdate(time.Now().Unix())
        }
    }
}()
}

func NewStockPricePushClient() *StockPricePushClient {
    m := StockPricePushClient{}
    return &m
}

func SetFooEvent(event StockPriceUpdateEevent) {
    GEventHandler = event
}

Java side:

Client.SetFooEvent(new EventHandler());

    Client.StockPricePushClient c = Client.NewStockPricePushClient();
    c.StartUpdate();

class EventHandler extends Client.StockPriceUpdateEevent.Stub {

    @Override
    public void PriceUpdate(long l) {

    }
}
@ghost ghost changed the title x/mobile/bind: local reference table overflow (max=52) x/mobile/bind: local reference table overflow (max=512) Feb 16, 2016
@gopherbot
Copy link

CL https://golang.org/cl/19532 mentions this issue.

@golang golang locked and limited conversation to collaborators Feb 28, 2017
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 10, 2021
The existing implementation has  memory leaks on two local variables
that are not deleted after use. Android app will crash after this issue.

add UnitTest for this issue.

Fixes golang/go#14346

Change-Id: Ic233d15556ac97b35e00e13279a572c48a03049f
Reviewed-on: https://go-review.googlesource.com/19532
Reviewed-by: Elias Naur <elias.naur@gmail.com>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 11, 2021
The existing implementation has  memory leaks on two local variables
that are not deleted after use. Android app will crash after this issue.

add UnitTest for this issue.

Fixes golang/go#14346

Change-Id: Ic233d15556ac97b35e00e13279a572c48a03049f
Reviewed-on: https://go-review.googlesource.com/19532
Reviewed-by: Elias Naur <elias.naur@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant