Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error message for memory allocation in vplayground #20896

Closed
enghitalo opened this issue Feb 23, 2024 · 1 comment
Closed

Better error message for memory allocation in vplayground #20896

enghitalo opened this issue Feb 23, 2024 · 1 comment
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@enghitalo
Copy link
Contributor

enghitalo commented Feb 23, 2024

Describe the bug

ugly panic error

Reproduction Steps

https://play.vlang.io/p/1e2bfc720e

const max_iterations = 947_009_999

fn main() {
	mut a := unsafe { malloc_noscan(max_iterations) }
	println(voidptr(a))

	mut b := unsafe { nil }
	println(voidptr(b))

	b = &[]u8{cap: max_iterations}
	println(voidptr(b))
}

Expected Behavior

better error message

Current Behavior

================ V panic ================
   module: builtin
 function: malloc_noscan()
  message: malloc_noscan(947009999) failed
     file: /home/admin/v/vlib/builtin/builtin.c.v:422
   v hash: 0514de7
=========================================
/tmp/v_60000/../../../../../../home/admin/v/vlib/builtin/builtin.c.v:66: at panic_debug: Backtrace
/tmp/v_60000/../../../../../../home/admin/v/vlib/builtin/builtin.c.v:422: by malloc_noscan
/tmp/v_60000/../../../../../../box/code.v:4: by main__main
/tmp/v_60000/../../../../../../tmp/v_60000/code.01HQC3MCD4MAQ1WSNW5QCKWS7H.tmp.c:16997: by main
Exited with error status 1

Possible Solution

No response

Additional Information/Context

No response

V version

vplaygrund version

Environment details (OS name and version, etc.)

vplaygrund OS

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@enghitalo enghitalo added the Bug This tag is applied to issues which reports bugs. label Feb 23, 2024
@spytheman
Copy link
Member

The playground is intentionally restricted - on RAM, CPU, and number of processes running, since it is a shared resource.

Run more demanding code locally, not on the playground.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

No branches or pull requests

2 participants