是否可以从 wolframscript 停止/杀死 Mathematica 前端?

问题描述

我使用 wolframscript 生成数百个这样的图像 visualization of 4fold symmetry of octahedron (将结合在动画视频中)像这样:

      Map[
       Export[
          "img" <> IntegerString[#,10,6] <> ".jpg",Show[
              (* Graphics3D with >300,000 polygons *),ViewVector -> {#,{0,#[[3]]}}& @ viewPoints[[#]],ViewVertical -> {0,1},ViewAngle -> 35 Degree,ImageSize -> Large
          ]
       ] &,Range[ ToExpression[#[[1]]],ToExpression[#[[2]]] ]& @ Rest[$ScriptCommandLine]
      ]

由于 FE 中的光栅化操作触发了 Mathematica Frontend 12.1.1 中的内存泄漏,我被迫从这样的 shell 脚本中分段运行脚本

./hp-h+h-bps+ghp-t7-s2-9.wls 1 5
./hp-h+h-bps+ghp-t7-s2-9.wls 6 10
./hp-h+h-bps+ghp-t7-s2-9.wls 11 15
...
./hp-h+h-bps+ghp-t7-s2-9.wls 191 195
./hp-h+h-bps+ghp-t7-s2-9.wls 196 200

是否可以从 wolframscript 中杀死前端? (运行["kill -9 pidOfMathematicaServer"] 将不起作用,因为这也会杀死产生 FE 的内核。)

解决方法

ihojnicki 在 mathematica.stackexchange 上回答: “您可以通过 Developer`UninstallFrontEnd[] 发布您的 FrontEnd 副本。”

效果很好,让我摆脱了 shell 脚本。