耗尽虚拟内存:无法分配内存

时间:2022-08-25 09:06:07

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.

我的编译在ubuntu 12.10上失败,有300mb的可用内存(总共750mb, 350mb到MySQL), 1.5ghz,我正在尝试将wt的基本hello world文件重新工作到一个简单的ajax页面中。我很确定这不是一个内存问题,因为我能够编译最初的hello。C文件加g+ -O3 -o你好。C -lwtfcgi轻型-lboost_signals。

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

我肯定我把c++搞砸了,因为我去掉了HelloApplication::HelloApplication(const wenvironment&env): WApplication(env)的核心部分,并引入了Wt::Json示例中的示例

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
}

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.

我是c++新手,所以我几乎不知道我在做什么。我所能做的就是执行最简单的c++文件。

Here's the original source to the hello world file.

这是hello world文件的原始源代码。

Here's where I got the json sample from.

这里是json示例的来源。

** Repercussions**

* * * *的影响

Wow, my respect level just went through the roof for the power of c++.

哇,我对c++的敬意之情溢于言表。

This has totally destroyed my VPS. I can't restart. I can't even reinstall my distro.

这完全摧毁了我的VPS。我不能重新启动。我甚至不能重新安装我的发行版。

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.

当我最终进入生产阶段时,我认为我将建立一个完全不同的开发系统来防止类似这样的事情破坏我的生产系统。

1 个解决方案

#1


0  

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?

由于编译失败,内存不足,因此可能没有足够的内存来编译程序。这不可能是由于“会话管理问题”,正如所接受的答案中所建议的那样。mysql是不是吃得太多了?300MB足够编译c++吗?

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.

在Wt中服务JSon(类似于REST接口)是通过绑定到WServer对象的WResource完成的。WApplication是用于交互用户界面的。

#1


0  

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?

由于编译失败,内存不足,因此可能没有足够的内存来编译程序。这不可能是由于“会话管理问题”,正如所接受的答案中所建议的那样。mysql是不是吃得太多了?300MB足够编译c++吗?

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.

在Wt中服务JSon(类似于REST接口)是通过绑定到WServer对象的WResource完成的。WApplication是用于交互用户界面的。