Sha256: 46b60153dd9e163ce6d6f66cc58887e67b155d210a299f587b0c15dd71d2cf5c

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

package main

/*
#include <stdlib.h>
#include "ruby/ruby.h"
*/
import "C"

import (
	"fmt"
	"unsafe"
)

var marked = make(map[unsafe.Pointer]int)

//export goobj_mark
func goobj_mark(obj unsafe.Pointer) {
	if LOG_LEVEL > 0 {
		marked[obj] = marked[obj] + 1
		fmt.Printf("MARK log obj %v; counter: %d; total number of MARKED objects: %d\n", obj, marked[obj], len(marked))
	}
}

//export goobj_log
func goobj_log(obj unsafe.Pointer) {
	if LOG_LEVEL > 0 {
		fmt.Println("log obj", obj)
	}
}

//export goobj_retain
func goobj_retain(obj unsafe.Pointer) {
	if LOG_LEVEL > 0 {
		fmt.Printf("retain obj %v - currently keeping %d\n", obj, len(objects))
	}
	objects[obj] = true
	marked[obj] = 0
}

//export goobj_free
func goobj_free(obj unsafe.Pointer) {
	if LOG_LEVEL > 0 {
		fmt.Printf("CALLED GOOBJ FREE %v - CURRENTLY %d objects left\n", obj, len(objects))
	}
	delete(objects, obj)
	delete(marked, obj)
}

//export goobj_compact
func goobj_compact(obj unsafe.Pointer) {
	if LOG_LEVEL > 0 {
		fmt.Printf("CALLED GOOBJ COMPACT %v", obj)
	}
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby_snowflake_client-1.0.2 ext/c-decl.go
ruby_snowflake_client-1.0.1 ext/c-decl.go
ruby_snowflake_client-1.0.0 ext/c-decl.go