低内存环境下的 YUI 压缩机

发布于 2024-08-15 05:06:03 字数 766 浏览 6 评论 0原文

有没有办法减少 YUI 压缩器所需的内存,或者是否有其他压缩器能够在“低”内存环境中通过命令行运行?

我的托管提供商对我可以从 shell 使用的内存和虚拟内存量有限制。目前它看起来像:ulimit -m 200000 -v 200000。 -v 参数似乎具有实际效果。当尝试在此环境中运行 YUI 压缩器时,我得到以下两个结果之一:

Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

Exception java.lang.OutOfMemoryError: requested 32756 bytes for ChunkPool::allocate. Out of swap space?

差异是由于第二个使用 JVM 参数 -Xms18m -Xmx18m 造成的一。我可以通过以下方式在本地 Linux 机器上复制此效果:

( ulimit -v 200000; java -Xmx18m -jar yui-compressor-2.4.2.jar -o foo-min.css foo.css )

我希望在更新源代码以推送到实时站点后立即在托管提供商上构建 javascript 和 css。

Is there a way to reduce the memory required by the YUI compressor or is there another compressor able to run via command line in "low" memory environments?

My hosting provider has limits on the amount of memory and virtual memory I can use from the shell. Currently it looks like: ulimit -m 200000 -v 200000. The -v argument is the one that seem to have a real effect. I get one of the following two results when trying to run the YUI Compressor in this environment:

Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

or

Exception java.lang.OutOfMemoryError: requested 32756 bytes for ChunkPool::allocate. Out of swap space?

The difference is due to using the JVM arguments -Xms18m -Xmx18m for the second one. I can duplicate this effect on my local linux box with the following:

( ulimit -v 200000; java -Xmx18m -jar yui-compressor-2.4.2.jar -o foo-min.css foo.css )

I'm looking to build both javascript and the css on the hosting provider immediately after an update of the source code to push to the live site.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

∞琼窗梦回ˉ 2024-08-22 05:06:03

通过使用 Sun 的 Small Footprint Runtime Environment,我能够让 YUI Compressor 在有限的内存空间中执行。

$ java -version
java version "1.5.0_10-eval"
Java(TM) 2 Runtime Environment, Standard Edition for Embedded (build 1.5.0_10-eval-b02, headless)
Java HotSpot(TM) Client VM (build 1.5.0_10-eval-b02, mixed mode)
Evaluation version, 90 days remain in evaluation period

我看到的唯一问题是它是一个评估版本,但在这个版本中我不必使用 -Xmx 或 -XX:MaxPermPool 选项。

I was able to get the YUI Compressor to execute in the restricted memory space by using the Small Footprint Runtime Environment from Sun.

$ java -version
java version "1.5.0_10-eval"
Java(TM) 2 Runtime Environment, Standard Edition for Embedded (build 1.5.0_10-eval-b02, headless)
Java HotSpot(TM) Client VM (build 1.5.0_10-eval-b02, mixed mode)
Evaluation version, 90 days remain in evaluation period

Only problem I see is that it's an evaluation version but with this version I didn't have to monkey around with -Xmx or -XX:MaxPermPool options whatsoever.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文