0
1
mirror of https://github.com/golang/go synced 2025-10-28 00:04:07 +00:00
Files
go/test/wasmmemsize.dir/main.go
Michael Anthony Knyszek 7fbf54bfeb internal/buildcfg: enable greenteagc experiment by default
Slightly bump the value in Test/wasmmemsize.go. We use 1 additional page
compared to before, and we were already sitting *right* on the edge.

For #73581.

Change-Id: I485df16c3cf59803a8a1fc852b3e90666981ab09
Reviewed-on: https://go-review.googlesource.com/c/go/+/656195
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-10-06 16:01:40 -07:00

32 lines
699 B
Go

// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"io"
)
// Wasm page size.
const pageSize = 64 * 1024
// Expect less than 3 MB + 1 page of memory usage for a small wasm
// program. This reflects the current allocator. If the allocator
// changes, update this value.
const want = 3<<20 + pageSize
var w = io.Discard
func main() {
fmt.Fprintln(w, "hello world")
sz := uintptr(currentMemory()) * pageSize
if sz > want {
fmt.Printf("FAIL: unexpected memory size %d, want <= %d\n", sz, want)
}
}
func currentMemory() int32 // implemented in assembly