问题描述
我的编译失败在ubuntu 12.10与300mb内存可用(总共750mb,350mb到MySQL),1.5ghz,我试图重构wt的基本hello世界文件到一个简单的ajax页面。我确定这不是一个内存问题,因为我能够编译原始的hello.C文件与 g ++ -O3 -o hello hello.C -lwtfcgi -lwt -lboost_signals
。
My compilation fails on ubuntu 12.10 with 300mb memory available (750mb total, 350mb to MySQL), 1.5ghz, I am trying to rework wt's basic hello world file into a simple ajax page. I'm pretty sure it's not a memory issue at heart since I was able to compile the original hello.C file with g++ -O3 -o hello hello.C -lwtfcgi -lwt -lboost_signals
.
我确定我在拧紧c ++,因为我撕掉了 HelloApplication :: HelloApplication(const WEnvironment& ; env)
并放在来自Wt :: Json示例的示例中
:WApplication(env)
I'm sure I'm screwing up the c++ since I ripped out the guts of HelloApplication::HelloApplication(const WEnvironment& env) : WApplication(env)
and put in the example from the Wt::Json example
HelloApplication::HelloApplication(const WEnvironment& env)
: WApplication(env)
{
Json::Object result;
Json::parse("{ "
" \"a\": \"That's great\", "
" \"b\": true "
"}",
result);
std::cerr << "Size: " << result.size(); << std::endl; // Size: 2
WString s = result.get("a");
bool b = result.get("b");
std::cerr << "a: " << s << ", b: " << b << std::endl; // a: That's great, b: true
}
,所以我几乎不知道我在做什么。我可以做的是执行最简单的c ++文件。
I'm new to c++, so I have almost no idea what I'm doing. All I can do is execute the simplest of c++ files.
这是最初的。
这里是我获得的json示例。
Here's where I got the json sample from.
** Repercussions * *
** Repercussions**
哇,我的尊重程度刚刚通过了c ++的力量。
Wow, my respect level just went through the roof for the power of c++.
毁了我的VPS。我无法重新启动。我甚至不能重新安装我的发行版。
This has totally destroyed my VPS. I can't restart. I can't even reinstall my distro.
当我终于开始生产时,我想我将建立一个完全不同的开发系统,以防止像这样
When I finally go into production, I think I'm going to set up a totally different dev system to prevent something like this killing my production system.
推荐答案
由于您的编译失败,内存不足,可能没有足够的内存来编译您的程序。这不可能是因为在接受的答案中建议的会话管理问题。是mysql吃得比它应该多吗?是否300MB足以编译C ++?
Since your compilation fails with out of memory, there's probably not enough memory to compile your program. This can't possibly be because of 'a session management problem' as suggested in the accepted answer. Is mysql eating more than it should? Is 300MB enough to compile C++ anyway?
在Wt中提供JSon(像REST接口一样)是通过绑定到WServer对象的WResource来完成的。 WApplication用于交互式用户界面。
Serving JSon (like for a REST interface) in Wt is done through a WResource bound to the WServer object. WApplication is for an interactive user interface.
这篇关于虚拟内存耗尽:无法分配内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!