如何设置set_prolog_flag(stack_limit,2_147_483_648)。使用swipl prolog将限制加倍

时间:2019-03-07 12:45:50

标签: json xsd prolog swi-prolog

我正在尝试使用序言通过gitmodule(https://github.com/fnogatz/xsd2json)运行xsd2 json对话。我试图通过命令行使用此方法运行时出现以下错误:

C:\xsd2json-master\lib-pl>swipl -g main cli.pl -- C:\proj_xsd\ref\p1_v1.xsd
ERROR: -g main: Stack limit (1.0Gb) exceeded
ERROR:   Stack sizes: local: 1.7Mb, global: 0.7Gb, trail: 0.2Mb
ERROR:   Stack depth: 20,761,408, last-call: 100%, Choice points: 4,174
ERROR:   In:
ERROR:     [20,761,408] xsd2json:json_created('C:\proj_xsd\ref\p1_v1.xsd', [], [length:1])
ERROR:     [20,761,407] xsd2json:json___3__0__0__3('<garbage_collected>', 'C:\proj_xsd\ref\p1_v1.xsd', [le
ngth:1], <compound json/1>, <compound suspension/9>)
ERROR:     [20,760,488] xsd2json:json___3__0('C:\proj_xsd\ref\p1_v1.xsd', '<garbage_collected>', '<garbage
_collected>', '<garbage_collected>')
ERROR:     [20,760,486] xsd2json:node___6__41__1__75('<garbage_collected>', <compound ns/2>, [length:2], <compound suspension/12>, [length:32], 'C:\proj_xsd\ref\p1_v1.xsd', <compound ns/2>, schema, [length:1], _10487734, [], <compound suspension/12>)
ERROR:     [20,740,111] xsd2json:xsd_flatten_nodes('C:\proj_xsd\ref\p1_v1.xsd', [], 0, [length:1], [], [le
ngth:1|_10487820])
ERROR:
ERROR: Use the --stack_limit=size[KMG] command line option or
ERROR: ?- set_prolog_flag(stack_limit, 2_147_483_648). to double the limit.

Prolog文档确实讨论了stack_limit,但没有说明如何设置它。

http://www.swi-prolog.org/pldoc/man?section=memlimit

1 个答案:

答案 0 :(得分:1)

在您发布的错误消息中说

ERROR: Use the --stack_limit=size[KMG] command line option or
?- set_prolog_flag(stack_limit, 2_147_483_648). to double the limit.

那你尝试跑步

C:\xsd2json-master\lib-pl>swipl --stack_limit=4G -g main cli.pl -- C:\proj_xsd\ref\p1_v1.xsd

或致电

?- set_prolog_flag(stack_limit, 2_147_483_648).

在Prolog中,如建议的那样?