[英]Why is mruby raising “arena overflow error”?
在我的MRuby代碼中進行救援時,我收到此錯誤:
arena overflow error
我不熟悉這個術語及其解決方法。 這是我的C程序的示例:
while (true) {
SDL_Event event;
if (SDL_PollEvent(&event)) {
if (event.type == SDL_QUIT) break; //exit the loop
switch(event.type) {
case SDL_KEYDOWN:
if (event.key.keysym.sym == SDLK_LEFT) { key = "left"; code = "input_received(:left)"; }
//...
printf("Key down: %s\n", key);
mrb_load_string(mrb, code);
break;
}
}
// Re-render each iteration
mrb_load_string(mrb, "render()"); //<-- this is the line that causes the error
}
使用mrb_gc_arena_save / mrb_gc_arena_restore阻止分配了臨時對象的代碼。
int ai = mrb_gc_arena_save(mrb);
// creating temporary objects
mrb_gc_arena_restore(mrb, ai);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.