mmap

Why does a JVM report more committed memory than the linux process resident set size?

匿名 (未验证) 提交于 2019-12-03 03:03:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When running a Java app (in YARN) with native memory tracking enabled ( -XX:NativeMemoryTracking=detail see https://docs.oracle.com/javase/8/docs/technotes/guides/vm/nmt-8.html and https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr007.html ), I can see how much memory the JVM is using in different categories. My app on jdk 1.8.0_45 shows: Native Memory Tracking: Total: reserved=4023326KB, committed=2762382KB - Java Heap (reserved=1331200KB, committed=1331200KB) (mmap: reserved=1331200KB, committed=1331200KB) -

Shmem vs tmpfs vs mmap [closed]

匿名 (未验证) 提交于 2019-12-03 02:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Does someone know how well the following 3 compare in terms of speed: shared memory tmpfs (/dev/shm) mmap (/dev/shm) Thanks! 回答1: Read about tmpfs here . The following is copied from that article, explaining the relation between shared memory and tmpfs in particular. 1) There is always a kernel internal mount which you will not see at all. This is used for shared anonymous mappings and SYSV shared memory. This mount does not depend on CONFIG_TMPFS. If CONFIG_TMPFS is not set the user visible part of tmpfs is not build, but the internal

ENODEV error in MMAP

匿名 (未验证) 提交于 2019-12-03 02:43:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to do a simple mapping of a new text file (given as a parameter) and I'm getting an ENODEV error in the mmap call. The fd is ok (no error in open call). According to the documentation this error means "The underlying file system of the specified file does not support memory mapping." or from another source I found that it can mean that fd is a file descriptor for a special file (one that might be used for mapping either I/O or device memory). I don't understand why any of these reasons would be the case. #include <sys/mman.h>

parsing a mmap()-ed file

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: What would be the best (fastest) way to parse through a mmap-ed file? It contains pairs of data (string int), but I cannot persume number of whitespaces/tabs/newlines between them. 回答1: Assuming you've mmaped the whole file in (rather than chunks - as that would make life awefully complicated), I'd do something like the following... // Effectively this wraps the mmaped block std::istringstream str; str.rdbuf()->pubsetbuf(<pointer to start of mmaped block>, <size of mmaped block>); std::string sv; std::string iv; while(str >> sv >> iv) { //

Mmap system call operation that is able to access memory locations

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am writing a program that allocates huge chunks of memory using mmap and then accesses random memory locations to read and write into it. I just tried out the following code: #include <stdio.h> #include <stdlib.h> #include <sys/mman.h> int main() { int fd,len=1024*1024; fd=open("hello",O_READ); char*addr=mmap(0,len,PROT_READ+PROT_WRITE,MAP_SHARED,fd,0); for(fd=0;fd<len;fd++) putchar(addr[fd]); if (addr==MAP_FAILED) {perror("mmap"); exit(1);} printf("mmap returned %p, which seems readable and writable\n",addr); munmap(addr,len); return 0; }

Java OutOfMemory exception: mmap error on loading zip file

匿名 (未验证) 提交于 2019-12-03 02:18:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I run my app on production env (rhel 5.2 x64, oracle jre 1.7_05, tomcat 7.0.28) with JVM arguments: -Xms8192m -Xmx8192m -XX:MaxPermSize=1024m -Doracle.net.tns_admin=/var/ora_net -XX:ReservedCodeCacheSize=512m -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -XX:+UseStringCache -XX:+OptimizeStringConcat -XX:+UseCompressedOops -XX:+UseG1GC -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9026 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false After several time i've got stack trace like

How to mmap a Linux kernel buffer to user space?

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Let's say the buffer is allocated using a page based scheme. One way to implement mmap would be to use remap_pfn_range but LDD3 says this does not work for conventional memory. It appears we can work around this by marking the page(s) reserved using SetPageReserved so that it gets locked in memory. But isn't all kernel memory already non-swappable i.e. already reserved? Why the need to set the reserved bit explicitly? Does this have something to do with pages allocated from HIGH_MEM? 回答1: The simplest way to map a set of pages from the

how to get current location in google map android

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Actually my problem is I am not getting current location latitude and longitude I tried so many ways.I know that this question already asked in SO I tried that answers also still I didn't get answer.Please help me Code: if (googleMap == null) { googleMap = ((MapFragment) getFragmentManager().findFragmentById( R.id.map)).getMap(); // check if map is created successfully or not if (googleMap == null) { Toast.makeText(getApplicationContext(), "Sorry! unable to create maps", Toast.LENGTH_SHORT) .show(); } } googleMap.setMyLocationEnabled(true);

mmap vs sbrk, performance comparison

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Which of these calls is faster on average? I've heard that mmap is faster for smaller allocations but I haven't heard a comparison of either. Any information on performance for these would be nice. 回答1: You should tag this with a particular implementation (like linux ) since the answer surely varies by implementation. For now I'll assume Linux since it's the most popular. With that said, brk is in theory more optimizable, and in practice it runs about 10% faster on my machine. Allocating one page, these are the times I get: brk :

Android NDK mmap call broken on 32-bit devices after upgrading to Lollipop

匿名 (未验证) 提交于 2019-12-03 02:00:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to grab 784 MiB of memory. Yes, I know that is a lot for a 32-bit phone, but the following call worked before Android 5.0: mmap(0, 0x31000000, PROT_NONE, MAP_ANON | MAP_SHARED, -1, 0); However, on three different devices from different manufacturers, upgrading to Android 5.0 has broken this. I assume this is some change in memory allocation functionality in 5.0; maybe different flags need to be passed in? Here's the error message returned in logcat: E/libc: mmap fail (pid 9994, tid 10125, size 822083584, flags 0x21, errno 12(Out