Tag: pipe

Python是否有一个堆栈/堆,如何pipe理内存?

在Python中如何pipe理variables和内存? 它是否有堆栈和堆,以及使用什么algorithm来pipe理内存? 鉴于这些知识,有没有关于大量/数据处理的内存pipe理的build议?

从shell脚本调用JMX MBean方法

是否有任何库允许我从shell脚本调用JMX MBean方法。 我们通过JMX公开一些操作/pipe理命令,我们可以让我们的pipe理员使用JConsole或VisualVM,但是有些任务最好留给自动化。 在这种自动化中,我们希望能够在运行的服务器上调用JMX MBean方法,最好是从shell脚本中调用。

rails 3.1.0 ActionView :: Template :: Error(application.css没有预编译)

我做了一个简单的带有索引函数的页面控制器的基本rails应用程序,当我加载页面时,我得到: ActionView::Template::Error (application.css isn't precompiled): 2: <html> 3: <head> 4: <title>Demo</title> 5: <%= stylesheet_link_tag "application" %> 6: <%= javascript_include_tag "application" %> 7: <%= csrf_meta_tags %> 8: </head> app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb__43625033_88530400' 的Gemfile source 'http://rubygems.org' gem 'rails', '3.1.0' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'sqlite3' gem 'execjs' gem 'therubyracer' # Gems used […]

分配更多的内存比使用malloc存在

这个代码片段每次从stdin中读取字母“u”时将分配2Gb,并且在读取“a”时将初始化所有分配的字符。 #include <iostream> #include <stdlib.h> #include <stdio.h> #include <vector> #define bytes 2147483648 using namespace std; int main() { char input [1]; vector<char *> activate; while(input[0] != 'q') { gets (input); if(input[0] == 'u') { char *m = (char*)malloc(bytes); if(m == NULL) cout << "cant allocate mem" << endl; else cout << "ok" << endl; activate.push_back(m); […]

如何知道指针是指向堆还是堆栈?

例: bool isHeapPtr(void* ptr) { //… } int iStack = 35; int *ptrStack = &iStack; bool isHeapPointer1 = isHeapPtr(ptrStack); // Should be false bool isHeapPointer2 = isHeapPtr(new int(5)); // Should be true /* I know… it is a memory leak */ 为什么,我想知道这一点: 如果我有一个类的成员指针,我不知道指针对象是否新分配。 然后,我应该使用这样的实用程序来知道是否必须delete指针。 但: 我的devise还没有制定。 所以,我将这样编程,我总是要delete它。 我要避免垃圾程序

弱NSStringvariables不是零后设置唯一强引用为零

我有这个代码的问题: __strong NSString *yourString = @"Your String"; __weak NSString *myString = yourString; yourString = nil; __unsafe_unretained NSString *theirString = myString; NSLog(@"%p %@", yourString, yourString); NSLog(@"%p %@", myString, myString); NSLog(@"%p %@", theirString, theirString); 我期待所有的指针在这个时候是nil ,但他们不是,我不明白为什么。 第一个(强)指针是nil但其他两个不是。 这是为什么?

如何在Go中pipe几个命令?

我怎样才能在Go中input几个外部命令? 我试过这个代码,但我得到一个错误,说exit status 1 。 package main import ( "io" "log" "os" "os/exec" ) func main() { c1 := exec.Command("ls") stdout1, err := c1.StdoutPipe() if err != nil { log.Fatal(err) } if err = c1.Start(); err != nil { log.Fatal(err) } if err = c1.Wait(); err != nil { log.Fatal(err) } c2 := exec.Command("wc", "-l") […]

Node.js将相同的可读streampipe道化成多个(可写)目标

我需要运行两个需要从同一个stream中读取数据的命令。 在将一个stream传输到另一个stream之后,缓冲区被清空,所以我无法再从该stream读取数据,所以这不起作用: var spawn = require('child_process').spawn; var fs = require('fs'); var request = require('request'); var inputStream = request('http://placehold.it/640×360'); var identify = spawn('identify',['-']); inputStream.pipe(identify.stdin); var chunks = []; identify.stdout.on('data',function(chunk) { chunks.push(chunk); }); identify.stdout.on('end',function() { var size = getSize(Buffer.concat(chunks)); //width var convert = spawn('convert',['-','-scale',size * 0.5,'png:-']); inputStream.pipe(convert.stdin); convert.stdout.pipe(fs.createWriteStream('half.png')); }); function getSize(buffer){ return parseInt(buffer.toString().split(' ')[2].split('x')[0]); } 要求抱怨这个 Error: […]

当程序退出时,是否有理由在C ++中调用delete?

在我的C ++ main函数中,例如,如果我有一个指向使用堆内存(而不是堆栈内存)的variables的指针 – 这是我的应用程序退出后自动释放? 我会这样认为的。 即使如此,即使您认为在退出时自动释放内存的情况下永远不会使用堆分配,也是一种很好的做法吗? 例如,有没有这样做的意义? int main(…) { A* a = new A(); a->DoSomething(); delete a; return 0; } 我在想也许万一我重构(或其他人重构)的代码,并将其放在应用程序的其他地方,其中delete是真的neccecary。 除了Brian R. Bondy(专门讨论C ++中的含义)的答案外 ,Paul Tomblin 对C特定的问题也有很好的回答,这个问题也谈到了C ++析构函数。

我怎样才能得到在java中的对象的内存位置?

我想知道JVM分配给放置在系统内存中的对象的位置。