PHP 官方 docker 镜像有什么区别?
我有一个大小为5 MB的数组,我将它传递给函数函数(我没有通过引用传递它)
foo( $arr );
function foo( $arr ) {
....
bar( $arr );
....
}
function bar( $arr ) {
....
test( $arr );
....
}
function test( $arr ) {
....
test2( $arr );
....
}
Run Code Online (Sandbox Code Playgroud)
PHP 默认情况下通过值(值的副本)将数组值传递给函数.
我的问题是,如果这个数组值传递给100个函数调用,那么PHP会消耗100 x 5 MB = 500 MB的内存吗?
PHP如何在函数调用上处理大数组(在内存方面)?
我的test.cpp
#include <uuid/uuid.h>
#include <iostream>
int main(int argc, char *argv[])
{
uuid_t id;
uuid_generate(id);
char *string = new char[100];
uuid_unparse(id, string);
std::cout << string << std::endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我正在使用Ubuntu 14
我正在运行我的test.cpp ...
g++ -luuid test.cpp
Run Code Online (Sandbox Code Playgroud)
和输出
test.cpp:(.text+0x26): undefined reference to `uuid_generate'
test.cpp:(.text+0x47): undefined reference to `uuid_unparse'
collect2: error: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
我的g ++版本:
Target: x86_64-linux-gnu
gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
Run Code Online (Sandbox Code Playgroud)
我已经安装了uuid-dev.
sudo apt-get install uuid uuid-dev
uuid is already the newest version.
uuid-dev is already the newest …Run Code Online (Sandbox Code Playgroud) 我在安装ruby gems时遇到以下错误.我正在使用Ubuntu
Installing json (1.7.3) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/json-1.7.3 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.7.3/ext/json/ext/parser/gem_make.out
An error occured while installing json (1.7.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.3'` succeeds before bundling.
Run Code Online (Sandbox Code Playgroud)
我刚看到这个链接,不知道如何处理ubuntu上的devkit*.exe文件.