From 11216f730451a292847505d464294ed7cf2c05c4 Mon Sep 17 00:00:00 2001 From: Jan Mercl <0xjnml@gmail.com> Date: Tue, 13 Jun 2017 15:18:34 +0200 Subject: Do not use fixed heap on Linux. Updates #12. modified: all_test.go modified: generator.go modified: internal/bin/bin_linux_386.go modified: internal/bin/bin_linux_amd64.go modified: main.c modified: sqlite.go modified: sqlite_go18.go --- generator.go | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) (limited to 'generator.go') diff --git a/generator.go b/generator.go index 8529cf3..2a7c450 100644 --- a/generator.go +++ b/generator.go @@ -61,33 +61,16 @@ import ( "unsafe" "github.com/cznic/crt" - "github.com/edsrzf/mmap-go" - ) -const minAlloc = 2<<5 +var inf = math.Inf(1) -var ( - inf = math.Inf(1) -) func ftrace(s string, args ...interface{}) { _, fn, fl, _ := runtime.Caller(1) fmt.Fprintf(os.Stderr, "# %%s:%%d: %%v\n", path.Base(fn), fl, fmt.Sprintf(s, args...)) os.Stderr.Sync() } - -func Init(heapSize, heapReserve int) int { - heap, err := mmap.MapRegion(nil, heapSize+heapReserve, mmap.RDWR, mmap.ANON, 0) - if err != nil { - panic(err) - } - - tls := crt.NewTLS() - crt.RegisterHeap(unsafe.Pointer(&heap[0]), int64(heapSize+heapReserve)) - crt.X__register_stdfiles(tls, Xstdin, Xstdout, Xstderr) - return int(Xinit(tls, int32(heapSize))) -} ` ) @@ -265,11 +248,13 @@ func main() { asta, src := build( ` + #define HAVE_MALLOC_H 1 + #define HAVE_MALLOC_USABLE_SIZE 1 #define HAVE_USLEEP 1 #define SQLITE_DEBUG 1 #define SQLITE_ENABLE_API_ARMOR 1 - #define SQLITE_ENABLE_MEMSYS5 1 #define SQLITE_USE_URI 1 + #define SQLITE_WITHOUT_MSIZE 1 `, [][]string{ {"main.c"}, -- cgit v1.2.3-70-g09d2