mmap

Java process getting killed likely due to Linux OOM killer

家住魔仙堡 提交于 2019-12-13 03:27:03
问题 My java process is getting killed after sometime. The heap settings are min - 2 Gb and max 3 Gb with parallel GC. From pmap command, it is showing more than 40 64Mb anonymos blocks which seems to be causing linux OOM killer. Error : There is insufficient memory for the Java Runtime Environment to continue. Native memory allocation (mmap) failed to map 71827456 bytes for committing reserved memory. Possible reasons: The system is out of physical RAM or swap space In 32 bit mode, the process

Parse stream of characters

岁酱吖の 提交于 2019-12-13 03:22:21
问题 Say I have an file something like this: *SP "<something>" *VER "<something>" *NAME_MAP *1 abc *2 def ... ... *D_NET *1 <some_value> *CONN <whatever> <whatever> *CAP *1:1 *2:2 <whatever_value> *1:3 *2:4 <whatever_value> *RES <whatever> <whatever> Let me describe the file once before I start describing my problem. File starts with some header notes. NAME_MAP section has the mapping information about the name and id given to that. That id would be used everywhere later when I want to specify

Using Pygeoip on Appengine - no module named mmap

心不动则不痛 提交于 2019-12-13 02:27:51
问题 I'm trying to do some IP-lookup on Python Google Appengine like this: import pygeoip gi = pygeoip.GeoIP('GeoIP.dat') Location = gi.country_code_by_addr(self.request.remote_addr) (pygeoip can be found here: http://code.google.com/p/pygeoip/) The above code executes fine locally but when I push it to the live server I get the following error: <type 'exceptions.ImportError'>: No module named mmap Traceback (most recent call last): File "/base/data/home/apps/tomcritchlow1/geoip.347423765058502279

How to unmap an mmap'd file by replacing with a mapping to empty pages

£可爱£侵袭症+ 提交于 2019-12-13 00:31:43
问题 Is there a way from Linux userspace to replace the pages of a mapped file (or mmap'd pages within a certain logical address range) with empty pages (mapped from /dev/null , or maybe a single empty page, mapped repeatedly over the top of the pages mapped from the file)? For context, I want to find a fix for this JDK bug: https://bugs.openjdk.java.net/browse/JDK-4724038 To summarize the bug: it is not currently possible to unmap files in Java until the JVM can garbage collect the

Memory pages used by a process in Linux

蹲街弑〆低调 提交于 2019-12-12 22:05:36
问题 I want to get the list of all mapped pages (allocated memory) in a Linux Process at runtime. How can I do that? 回答1: From inside the process, on Linux, you can read and parse /proc/self/maps ; try cat /proc/self/maps which will show you the memory map of the process running that cat From another process, for the map of the process of pid 1234, you can read /proc/1234/maps And there is also /proc/self/smaps etc. The Linux specific dladdr function is sometimes useful also. If you are concerned

How to use regexec with memory mapped files?

丶灬走出姿态 提交于 2019-12-12 21:22:33
问题 I am trying to find a regular expression in a large memory mapped file by using regexec() function. I discovered that the program crashes when the file size is the multiple of the page size. Is there a regexec() function that has the length of the string as additional argument? Or: How to find a regex in a memory mapped file? Here is the minimal example that ALWAYS crashes (if I run less that 3 threads program doesn't crash): ls -la ttt.txt -rwx------ 1 bob bob 409600 Jun 14 18:16 ttt.txt gcc

Alsa api: how to use mmap in c?

荒凉一梦 提交于 2019-12-12 18:59:55
问题 I'm currently using snd_pcm_writei to play a sound file that was previously loaded into an array of short (16 bits PCM format). To play this sound I create a buffer (short*), that contains a period (or fragment). Then, I use a while loop to call snd_pcm_writei which gives me that line: int err = snd_pcm_writei(handle, buffer, frames); It is pretty simple to understand how it works, and everything works fine, I can hear the sound. However, I'd like to try to use mmap instead of writei, but I

Can I ask the kernel to populate (fault in) a range of anonymous pages?

大城市里の小女人 提交于 2019-12-12 18:15:22
问题 In Linux, using C, if I ask for a large amount of memory via malloc or a similar dynamic allocation mechanism, it is likely that most of the pages backing the returned region won't actually be mapped into the address space of my process. Instead, a page fault is incurred each time I access one of the allocated pages for the first time, and then kernel will map in the "anonymous" page (consisting entirely of zeros) and return to user space. For a large region (say 1 GiB) this is a large number

mmap SIGBUS error and initializing the file

回眸只為那壹抹淺笑 提交于 2019-12-12 15:24:19
问题 I'm trying to model a basic CPU by mmapping a 1 MiB file, corresponding to the RAM size. I want to read/write this file. Currently I'm getting a SIGBUS error with ram[2] = 1 which I gather is from trying to mmap outside the file range. I've read that perhaps I need to fill the file with zeroes as placeholders, but I'm a bit confused as to why I have to do this, since I thought mmap would automatically set aside a memory chunk for me that would be allocated when I first touch it (as I am

mmap a 10 GB file and load it into memory

你说的曾经没有我的故事 提交于 2019-12-12 10:47:17
问题 if I want to mmap a 10 GB file and load the whole file into physical memory immediately, how can I do so? I don't want to use function like mlock because it needs root privileges. Is there a system call which can satisfy my demand? (I have more than enough memory.) 回答1: Read the man-page for mmap: MAP_POPULATE (since Linux 2.5.46) Populate (prefault) page tables for a mapping. For a file mapping, this causes read-ahead on the file. Later accesses to the mapping will not be blocked by page