- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
在我的代码中有必要分配几个大数组。
但是,当我尝试使用 IBM xlc_r 时:
xlc_r -g -O -L。 -qarch=pwr7 -qtune=pwr7 -lesslsmp -lm -qsmp -qthreaded -qmaxmem=-1 2.c
int main()
{
int natom = 5000;
while(1)
{
double *z =(double*) malloc(natom*natom*natom* sizeof(double));
if(!z)
{
printf("error memory vector z\n\n");
exit(-1);
}
}
}
我收到 Killed 内存 vector z 错误。
这是 ulimit -a
:
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 102400
pipe size (512 bytes, -p) 64
stack size (kbytes, -s) unlimited
cpu time (seconds, -t) unlimited
max user processes (-u) 128
virtual memory (kbytes, -v) unlimited
分配更多内存是否需要任何标志?
最佳答案
不久前,我在一台 POWER775 AIX 机器上遇到了这个问题。您需要在编译时添加 -q64
标志,以便分配超过 2GiB 的内存。请注意,其他人关于使用 int
的评论可能与您的代码相关,这就是我下面的示例使用 size_t
的原因。
我建议您运行一个简单的分配测试来调查这一点。我为这种情况编写的测试程序如下。
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char * argv[])
{
size_t max = (argc>1) ? (size_t)atol(argv[1]) : ((size_t)256*1024)*((size_t)1024*1024);
for (size_t n=1; n<=max; n*=2) {
printf("attempting malloc of %zu bytes \n", n);
fflush(0);
void * ptr = malloc(n);
if (ptr==NULL) {
printf("malloc of %zu bytes failed \n", n);
fflush(0);
return 1;
} else {
printf("malloc of %zu bytes succeeded \n", n);
fflush(0);
memset(ptr,0,n);
printf("memset of %zu bytes succeeded \n", n);
fflush(0);
free(ptr);
}
}
return 0;
}
相关的构建标志如下。
ifeq ($(TARGET),POWER7-AIX)
# Savba i.e. POWER775 AIX
CC = mpcc_r
OPT = -q64 -O3 -qhot -qsmp=omp -qtune=pwr7 -qarch=pwr7 -qstrict
CFLAGS = $(OPT) -qlanglvl=stdc99
endif
关于c++ - IBM AIX 中的内存分配使用 xlc 编译器失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35567428/
我在AIX上使用shell脚本。 我已经使用chmod授予了执行权限 不过,我收到以下错误: ksh: ./getcwd.exe: 0403-006 Execute permission denied
我找不到 objdump IBM AIX 5.1 机器中的命令。实际上,我想从 AIX 中生成的库中获取汇编指令(反汇编)。 Linux 有 objdump命令和solaris dis命令来执行此操作
我需要在 AIX 环境中编写一个 C 程序,它会给我进程名称。 我可以根据 pid 获取 pid 但不能获取进程名称。 aix 环境中可用的任何特定系统调用? 谢谢 最佳答案 getprocs 很可能
在 AIX 上,我会运行: ar -X32 -t libdb2.a 并检查输出以确定存档中是否有 32 位对象。与 -X64 类似,用于检查 64 位对象。但是,如果我在另一个平台上,并且需要检查存档
我们需要将许多使用 Sun JDK 构建并在 Solaris 10 中的 sun JRE 上运行的 Java 应用程序迁移到 AIX。 我们担心该应用程序在 IBM J9 JRE 上的运行情况相同。
我有一些类似于以下的代码: #include #include #include #include #include #include #include #include #inclu
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我使用的是 AIX 5.3,而且我对该操作系统完全是菜鸟。我想知道 AIX 上是否有类似 inotify 的东西,以便可以监视目录和文件的更改而不是轮询。我将从 Java 中执行此操作,因此使用 Ja
AIX 中的交换信息命令:lsps -a AIX 中的交换信息输出: Page Space Physical Volume Volume Group Size %Used Acti
我有手动运行良好的脚本,但在通过 cronjob 运行时没有获得所需的输出。如果脚本有任何问题,请告诉我。 #!/usr/bin/ksh file1=$(find *-* -mtime 1) file
我正在尝试在 IBM AIX 中编译一些 C 代码,但它似乎在函数指针方面存在一些严重问题。 以下是一些无法编译的代码: typedef int (*strategy_fn)(const unsign
我有一个 C 程序 hello.c。我创建了一个共享对象 hello.so。 hello.c 和 hello.so 分别位于目录/u/grv/program/hello.c/u/grv/objects
当运行使用 -pthread 编译的代码时抛出 C++ 异常时,我们会中止。 平台:AIX 5.3 技术等级 8编译器:gcc 3.4.6链接器:AIX 链接器 1.65.2.4 测试代码: // e
我从 Centos 6 通过 ssh 连接到 AIX 5.3。AIX 和 Centos 上的 shell 是 bash。当我在 shell 中按“Home”、“End”、“PgUp”、“PgDn”时,
我运行了 lparstat 命令并得到了这个输出。需要知道要解析哪个字段以获得总体 CPU 分配、CPU 使用率、此 AIX 服务器的空闲 CPU 以及如何解析该信息。 System configur
谁能推荐可用于以编程方式检查内存使用情况的 AIX 系统调用?我正在使用一个大型多线程 C++ 应用程序,该应用程序当前由于存在大量无限的内存缓存而内存不足(在 AIX 6.1 上使用 32 位大内存
我在 AIX 6.1 上运行此代码 while(true) { int a = rand(); //generate a random integer value void* test
xmalloc只有当我编写AIX内核扩展时才能在进程环境中使用。 AIX 中中断环境可以调用哪些内存分配函数? 谢谢。 最佳答案 网络内存分配例程。查看/usr/include/net/net_mal
我在 AIX 上工作,有一个进程不断崩溃。我从未检查过核心文件,如果可能的话,我希望得到一些指导。我正在使用 dbx。我如何才能 (a) 确保核心文件到达我希望它到达的位置,以及 (b) 在崩溃之前查
通过执行一个简单的循环创建线程java程序,当我使用 -Xmx2048M 时,AIX 的线程计数限制约为 900,当我将该参数减少到 -Xmx1024M 时,线程计数限制增加到 2000 左右。 ul
我是一名优秀的程序员,十分优秀!