Questions tagged [memory-overcommitment]

17 questions
13
votes
3 answers

new[] doesn't decrease available memory until populated

This is in C++ on CentOS 64bit using G++ 4.1.2. We're writing a test application to load up the memory usage on a system by n Gigabytes. The idea being that the overall system load gets monitored through SNMP etc. So this is just a way of…
fwg
  • 1,018
  • 2
  • 10
  • 25
8
votes
2 answers

Malloc on linux without overcommitting

How can I allocate memory on Linux without overcommitting, so that malloc actually returns NULL if no memory is available and the process doesn't randomly crash on access? My understanding of how malloc works: The allocator checks the freelist if…
FSMaxB
  • 2,280
  • 3
  • 22
  • 41
8
votes
2 answers

Do mmap/mprotect-readonly zero pages count towards committed memory?

I want to keep virtual address space reserved in my process for memory that was previously used but is not presently needed. I'm interested in the situation where the host kernel is Linux and it's configured to prevent overcommit (which it does by…
R.. GitHub STOP HELPING ICE
  • 208,859
  • 35
  • 376
  • 711
8
votes
3 answers

fork() failing with Out of memory error

The parent process fails with errno=12(Out of memory) when it tries to fork a child. The parent process runs on Linux 3.0 kernel - SLES 11. At the point of forking the child, the parent process has already used up around 70% of the RAM(180GB/256GB).…
Anirudh Jayakumar
  • 1,171
  • 3
  • 15
  • 37
5
votes
1 answer

Disabling Linux memory overcommit inside an application

You can adjust the memory overcommit policy system-wide via sysctl calls, but is it possible to adjust this policy on a per-process basis from within the process itself? I want to make one particular real-time process never use overcommit, though…
Joe
  • 7,378
  • 4
  • 37
  • 54
4
votes
1 answer

How to obtain "CPU Ready" values for a KVM guest?

I'm trying to measure the effects of cpu overcommitting on a KVM setup (both host and guest). I can detect performance is degraded when the number of vCPUs is increased but ideally I want to look at some more objective metric (like CPU Ready in…
pldimitrov
  • 1,597
  • 2
  • 16
  • 21
3
votes
1 answer

C++ memory overcommit Linux

I am currently coding a server application that basically processes workloads for clients. Based on the actual workload, the server could use huge amounts of memory. Target Platforms are Windows and Linux, the code is written in c++. However, i am…
erik
  • 57
  • 7
2
votes
2 answers

numpy wont overcommit memory even when vm.overcommit_memory=1

I am running into a numpy error numpy.core._exceptions.MemoryError in my code. I have plenty of available memory in my machine so this shouldn't be a problem. (This is on a raspberry pi armv7l, 4GB) $ free total used free…
Almog-at-Nailo
  • 1,152
  • 1
  • 4
  • 20
1
vote
1 answer

Advantages vs disadvantages of vm.overcommit_memory=1 vs vm.overcommit_memory=0

On Linux, if vm.overcommit_memory=1, you can allocate huge memory blocks, but if you use less, these will not affect memory usage. Lets suppose following code: const size_t size = 128; void p = malloc(size); process(p, size); // use up to size…
Nick
  • 9,962
  • 4
  • 42
  • 80
1
vote
1 answer

Linux `top` command: how much process memory is physically stored in swap space?

Let's say I run my program on a 64-bit Linux machine with 64 Gb of RAM. In my very small C program immediately after the start I do void *p = sbrk(1024ull * 1024 * 1024 * 120); this moving my data segment break forward by 120 Gb. After the above…
1
vote
0 answers

Deduce if malloc is likely to fail

Is there a pessimistic way of figuring out if a malloc will fail. I am somewhat worried about this: By default, Linux follows an optimistic memory allocation strategy. This means that when malloc() returns non-NULL there is no guarantee that the…
user877329
  • 6,717
  • 8
  • 46
  • 88
0
votes
0 answers

How to allow overcomitting only for one application in Linux?

I think this is a common use case: You have an OS running many applications and the most important app running is both, very memory intensive and at the same time performance critical. You may want to allocate some containers reserving a lot of…
Patrick Fromberg
  • 1,313
  • 11
  • 37
0
votes
0 answers

Cannot allocate memory when overcommit_memory=1

I have /proc/sys/vm/overcommit_memory set to 1, which I thought would allow any amount of memory overcommit, up to the range allowed by a 64bit pointer. However, when my memory request becomes large enough, around 86Tb, the mmap call begins to fail.…
0
votes
1 answer

Des-initializing a region of memory

I have learn in the few past days the issue with memory overcommitment (when memory overcommit is activated, which is usually a default), which basically means that: void* p = malloc(100); the operative system gives you 100 contiguous (virtual)…
ABu
  • 10,423
  • 6
  • 52
  • 103
0
votes
2 answers

Is posible show if openstack is overcommitting memory in a virtual machine only from OS?

How could I know from Operating System in a Virtual Machine if ram memory is being overcommited by Openstack hypervisor? My app is being killed by the operating system cause Out of Memory error, but I have configured the heap and meta space under…
1
2