Skip to content

Instantly share code, notes, and snippets.

View erikcorry's full-sized avatar
🏠
Working from home

Erik Corry erikcorry

🏠
Working from home
View GitHub Profile
/// Simple pretty-printer for JSON-compatible objects (maps, lists, strings,
/// numbers, booleans, and null).
pretty-print data --indent/string="" --prefix/string?=null --suffix/string?="" -> none:
str := json.stringify data
if str.size < 80:
print "$(prefix or indent)$str$suffix"
return
if data is Map:
print "$(prefix or indent){"
i := 0

Memory use, performance, and Toit pixel display.

(March 2024).

Some applications using pixel displays may run out of memory, especially if you are running on a small ESP32 with no external PSRAM. This is especially the case if you are using the small jaguar server on the device for fast edit-compile-run development cycles.

@erikcorry
erikcorry / huge-regexp.js
Created June 18, 2024 12:32
Huge regexp test for bug 40261789
const terms = `\u0446\u0435\u043b\u044c\u044e|\u0446\u0435\u043b\u044c \u0438\u0441\u0441\u043b\u0435|\u0440\u0435\u0437\u044e\u043c\u0435|\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442|\u043f\u0440\u0435\u0434\u043c\u0435\u0442|\u043c\u0435\u0442\u043e\u0434\u0438\u043a\u0430|\u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b|\u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0438 \u043c\u0435\u0442\u043e\u0434\u0438\u043a\u0430|\u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438|\u0432\u044b\u0432\u043e\u0434|\u0432\u0432\u0435\u0434\u0435\u043d\u0438|\u0426\u0435\u043b\u044c|\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b|\u041c\u0435\u0442\u043e\u0434\u044b|\u041a\u0440\u0430\u0442\u043a\u0438\u0435 \u0438\u0442\u043e\u0433\u0438|\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435|\u0412\u044b\u0432\u043e\u0434\u044b|\u0412\u0438\u0441\u043d\u043e\u0432\u043a\u0438|\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435|\u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f|\
$ (cd out.gn/x64.optdebug; gdb --args cctest test-api/TwoIsolateGroups --random-seed=-515469024 --nohard-abort --verify-heap --enable-slow-asserts --testing-d8-test-runner)
GNU gdb (GDB) 15.1
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
@erikcorry
erikcorry / gist:05dcf38ef52cd4f56895496abe850775
Created December 19, 2024 14:51
args.gn to repro test failure
clang_version = "20"
use_rtti = true
use_sysroot = false
v8_enable_pointer_compression_shared_cage = false
v8_enable_external_code_space = false
cppgc_enable_caged_heap = false
icu_use_data_file = false
# These are defines only relevant to Chromium not V8, no need to have them here.
use_aura = false
use_blink = false
python3 ../../tools/run.py ./mksnapshot --turbo_instruction_scheduling --stress-turbo-late-spilling --target_os=linux --target_arch=x64 --embedded_src gen/embedded.S --predictable --no-use-ic --embedded_variant Default --random-seed 314159265 --startup_src gen/snapshot.cc --native-code-counters --concurrent-builtin-generation --concurrent-turbofan-max-threads=0 --verify-heap
=================================================================
==1412959==ERROR: AddressSanitizer: heap-use-after-free on address 0x75a4a36202c0 at pc 0x5c2e6e9dca2f bp 0x7ffece69cad0 sp 0x7ffece69cac8
READ of size 8 at 0x75a4a36202c0 thread T0
#0 0x5c2e6e9dca2e in v8::internal::VirtualMemory::Free() src/utils/allocation.cc:286:52
#1 0x5c2e6cec2c69 in v8::internal::CodeRange::Free() src/heap/code-range.cc:361:24
#2 0x5c2e6cec2c69 in v8::internal::CodeRange::~CodeRange() src/heap/code-range.cc:93:27
#3 0x5c2e6d66c7c6 in std::__Cr::default_delete<v8::internal::CodeRange>::operator()(v8::internal::CodeRange*) const third_p