低内存环境下的 YUI 压缩机
有没有办法减少 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过使用 Sun 的 Small Footprint Runtime Environment,我能够让 YUI Compressor 在有限的内存空间中执行。
我看到的唯一问题是它是一个评估版本,但在这个版本中我不必使用 -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.
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.