-
Notifications
You must be signed in to change notification settings - Fork 7
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
Exceeding some character count results in a memory related crash #22
Comments
increase the budget in asconfig.json:options.memoryBase ( say, 655360 = 640kB ) Line 18 in 0d0c942
then rebuild (npm run asbuild) 🥂 |
Okay, that makes sense. Thanks for the quick reply! Is there a way to calculate what values will be a problem for a given font, or is the only way to wrap every call to |
Hmm. I can't seem to recover from this error at all. I've even tried reloading the entire complier mechanism (which would be pretty heavy to do every time this error occurs) to no avail. All subsequent calls to Here is (roughly) the reloading code I attempted:
|
a workaround off the top of my head bytes required for function bytes_required(font, text) {
let b = 0
const cmds = font.raw.getPath(text, 0, 0, 100).commands
for (const cmd of cmds) {
b += 1
switch (cmd.type) {
case 'M':
case 'L': b += 16; break
case 'Q': b += 48; break
case 'C': b += 64; break
}
}
return b
} then, validate before each if ( bytes_required(font, 'hello') <= 65536 ) {
// builder.create( .. )
} where 65536 := asconfig.json:options.memoryBase 🥂 |
Awesome. Thanks again! I'll give this a shot. |
solved in v4. |
This seems to be both font and character specific.
Experimenting with the
NotoSansMono-Thin
and updating the example (bare/index.js
) text value to 241*
characters results in the following traceback:Using 241
l
characters instead, does not result in this crash. Other fonts can result in much lower limits before this happens.Is this some kind of natural limitation (if so, is there a calculation that can prevent it) or a bug in memory management somewhere?
The text was updated successfully, but these errors were encountered: