Skip to content
This repository has been archived by the owner on Oct 19, 2019. It is now read-only.

Allocating a few MB in V8Worker2.recv crashes when looping worker.SendBytes #28

Open
gshahbazian opened this issue Jan 8, 2019 · 0 comments

Comments

@gshahbazian
Copy link

Run this test app:

main.go

package main

import (
	"github.com/ry/v8worker2"
)

func main() {
	worker := v8worker2.New(func(msg []byte) []byte {
		return nil
	})

	err := worker.Load("codeWithRecv.js", `
		V8Worker2.recv(function(msg) {
			var data = new ArrayBuffer(5600000)
		})
	`)
	if err != nil {
		panic(err)
	}

	for i := 0; i <= 1000; i++ {
		err = worker.SendBytes([]byte(`test`))
		if err != nil {
			panic(err)
		}
	}
}


Throws this exception:

main(56725,0x70001067a000) malloc: *** error for object 0x60028e0: pointer being freed was not allocated
main(56725,0x70001067a000) malloc: *** set a breakpoint in malloc_error_break to debug
signal: abort trap

Platform: macOS 10.14.2

Note: built against v8 6.9.427.19 as suggested here: #22

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant