/**
* $Id: mmap.cpp 1595 2012-07-28 10:33:18Z shijia.wxr $
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#define MMAP_FILE_SIZE (1024 * 1024 * 1024)
int main(int argc, char** argv)
{
int i = 0;
for(i = 1; ; i++) {
char filePath[64] = {0};
sprintf(filePath, "%d", i);
int fd = open(filePath, O_RDWR | O_CREAT);
if(fd < 0) {
printf("open failed\n");
break;
}
ftruncate(fd, MMAP_FILE_SIZE);
void* p = mmap(0, MMAP_FILE_SIZE, PROT_WRITE, MAP_SHARED,fd, 0);
if(p != 0) {
memset(p, 0, MMAP_FILE_SIZE);
printf("mmap OK, %d\n", i);
} else {
printf("mmap Failed, exit.\n");
break;
}
}
while (1) {
printf("sleeping\n");
sleep(1);
}
return 0;
}
相关推荐
Application memory tuning provides more of the computer's virtual memory to applications by providing less virtual memory to the operating system. Although a system having less than 2 GB of physical ...
max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 7168 virtual memory ...
x_test = preprocessing.sequence.pad_sequences(x_test, maxlen=MAX_LEN) MAX_WORDS = x_train.max() + 1 CAT_NUM = y_train.max() + 1 # 构建数据集 ds_train = tf.data.Dataset.from_tensor_slices((x_train, y...
3. **内存限制**:虽然V8会自动进行GC,但开发者可以通过设置`--max-old-space-size`等命令行参数来限制V8的最大旧空间大小,从而控制内存使用。在VM模块中,也可以通过设置`options.maxOldGenerationSize`来限制...
- Determine and select max physical address size automatically at configure time: - 32-bit physical address for 386/486 guests - 36-bit physical address for PSE-36 enabled Pentium guest - 40-bit ...
I deferred from testing the get test over 100 million record as it would require a huge array in memory to store the Guid keys for finding later, that is why there is a NT (not tested) in the table. ...
* use max_send_size 255 / max_recv_size 256 bytes by default. reduce this for some readers (e.g. scm) with t=0 cards. * increase pin buffer size to allow longer pin codes. * Windows Make.rules.mak ...
Virtual kernel memory layout: vector : 0xffff0000 - 0xffff1000 ( 4 kB) fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB) DMA : 0xffc00000 - 0xffe00000 ( 2 MB) vmalloc : 0xc4800000 - 0xf6000000 ( 792 MB) ...
- NEW: Add textfield maxwidth feature. - NEW: Add API to query package dependencies. - IMPROVED: Graphics module refactor. Now it is more convenient to create various shapes(pie, lines, polygon etc) ...
PEP 486: Make the Python Launcher aware of virtual environments PEP 488: Elimination of PYO files PEP 489: Multi-phase extension module initialization Other Language Changes New Modules typing ...