diff --git a/keepalive.go b/keepalive.go new file mode 100644 index 00000000..410ed278 --- /dev/null +++ b/keepalive.go @@ -0,0 +1,9 @@ +// +build go1.7 + +package main + +import "runtime" + +func keepAlive(i interface{}) { + runtime.KeepAlive(i) +} diff --git a/keepalive_old.go b/keepalive_old.go new file mode 100644 index 00000000..71915966 --- /dev/null +++ b/keepalive_old.go @@ -0,0 +1,7 @@ +// +build !go1.7 + +package main + +func keepAlive(i interface{}) { + // Dummy function. Do nothing +} diff --git a/process.go b/process.go index eb794913..2021ec95 100644 --- a/process.go +++ b/process.go @@ -160,7 +160,7 @@ func calcCrop(width, height int, po processingOptions) (left, top int) { } func processImage(data []byte, imgtype imageType, po processingOptions) ([]byte, error) { - defer runtime.KeepAlive(data) + defer keepAlive(data) err := C.int(0)