Memory release latency issue

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Memory release latency issue
# 8  
Old 09-05-2014
Quote:
Originally Posted by imagtek
Thanks all for very informative replies. Memory allocation at the system level is more complex than I thought. I'll dig into the mmap() possibility. Part of my design-for-performance strategy working with huge images is to code low-level and as close to the system as possible, so it looks like more work to do there. As I said, first time through these algorithms fly, then its like they get stuck in the mud. Sometimes simply painting the screen hangs for seconds at a time. Always immediately after using/freeing massive blocks of memory.
As pointed out earlier, why not just keep them around?
Quote:
I'll play around with some of these ideas and let you know what I find. I'm pushing my old 8 GB machine to its limits, maybe a bit past them, but that is what its for.
8GB is nothing to sneeze at.
# 9  
Old 09-05-2014
keep memory around rather than alloc / free

Well as a matter of fact my application is already a memory hog... Each RGBA pixel is 4 bytes and the display footprint is barely visible on some of these images. I keep image buffers in memory so the user can 'pan' them using a compressed view to navigate. No problems there because the display footprint is never that much memory and I just discard motion events that occur while the screen is updating. Also redefine the XImage as the new mapping to the display with every update because X was crashing when trying to map an entire 4+ GB buffer. So since its already a memory hog, and can't assume I'm the only app running, just grabbing a massive scratch buffer to have handy seems not a great idea. But maybe I'm missing something about how virtual memory works with that attitude?
# 10  
Old 09-05-2014
But you are using massive scratch buffers, and the memory has to come from somewhere. Give it away and you might have a hard time getting it back.

How about a mid-way compromise? Let the OS decide which bits to cache. Let the OS decide how much memory can be spared against the competition of other programs. Let the OS do all the heavy lifting. You can do this all while still using what's, to your program, still a huge, contiguous chunk of memory.

Make and keep a huge scratch file. You can map that into memory with mmap() -- memory accesses effectively become file accesses. This takes advantage of the file cache, so the OS will cache any bits of it you're using. The OS will cache recently accessed chunks, and turf infrequently accessed chunks back to disk. This is how many large database applications do I/O. If you have enough memory, you'll end up dealing almost exclusively with memory, not waiting for disk.

Your application will have to wait for bits to load, but it will wait for page-sized chunks, not an entire 8-gigabyte memory alloc. And if you have enough memory, it can cache everything without you having to ask. You can also do fun things like "copy-on-write", meaning that the mapping will do just what it says above for reads, but when you write to any of the memory, it won't bother writing the changes to disk, just keep it in RAM.

You can also optimize things further, warning the OS so it doesn't have to guess. "Could you cache these nearby parts for me since the user's probably going to scroll over them soon? More important than whatever faraway parts you have cached, thanks". That's what posix_madvise can do to mmaped segments.

Last edited by Corona688; 09-05-2014 at 02:57 PM..
This User Gave Thanks to Corona688 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

Swap memory issue

Hi, In our production box i can see the Swap space using the below command free total used free shared buffers cached Mem: 65963232 41041084 24922148 0 877160 35936292 -/+ buffers/cache: 4227632 61735600 Swap: 4192880 ... (6 Replies)
Discussion started by: ratheeshjulk
6 Replies

2. Red Hat

Memory Issue

I could not find what is consuming the memory, generated DSET reports and NO hardware wise memory issue. 64 GB RAM on a server yet all I could see is a very limited memory available. I am not sure if I am reading this correct or not. I have used free -t -m and cat /proc/meminfo (results below)... (3 Replies)
Discussion started by: rsheikh01
3 Replies

3. AIX

Memory issue

I have a server with 300Gb allocated to it. Some times I observed in topas Comp% 73 and Non comp 35% and client is also 35% and my paging is showing 92%. If my physical memory utilized only 70% then why paging is so high. And what is relation between Comp, noncomp and client? If the memory... (1 Reply)
Discussion started by: powerAIX
1 Replies

4. Solaris

Zone memory issue

We have a zone configured in our X4600 machine with memory capped to 16GB. Most of the time zone is running with high physical memory utilization. It seems from "top" command shows that the command "kernel" is locks 15GB phy. memory and not using swap memory. Whenever we restart the application... (2 Replies)
Discussion started by: rock123
2 Replies

5. AIX

AIX memory issue

Currently server have load while there is no heavy things running, just oracle database/ application server oracle. I don't understand why server have heavy load, 22GB is under buffer, how to clean buffer/memory in AIX load averages: 9.42, 9.43, 9.68; 05:25:08 141 processes: 125 idle, 16... (12 Replies)
Discussion started by: learnbash
12 Replies

6. Solaris

Locked memory issue

One of our project has exceeded its assigned max-memory-locked by 3 times .. The said project is using around 9 gigs as described by rss parameter in prstat -J .. and the max-project-memory parameter has been defined as 3gigs .. is it normal or we are monitoring the project memory usage in wrong... (2 Replies)
Discussion started by: fugitive
2 Replies

7. Linux

Virtual Memory issue

Hi all, I was compiling my glibc 2.6.1 source files on a new kernel 2.66.22.6 and it seems that i am running into issues with the Virtual Memory. It displays the error message: virtual memory exhausted: Cannot allocate memory‏ I saw an article on how to adjust the parameters but i can't... (5 Replies)
Discussion started by: scriptingmani
5 Replies

8. AIX

Shared memory issue

Hi friends.. Help to solve this issue... Is there any parameter setting to control or limit the size of the shared memory a process can attach for the below specified environment? The man pages says it can attach upto segments of size 2GB. But when our process (which also connects to... (0 Replies)
Discussion started by: sdspawankumar
0 Replies

9. Linux

Memory issue while diff !!!

Hi All Any idea? why am I having this memory issue? perforce@ixca-pforce-bak:/home/p4-demo-root$ diff checkpoint_offline ../p4-demo-root2/checkpoint.1150 diff: memory exhausted Thanks a lot C Saha (0 Replies)
Discussion started by: csaha
0 Replies

10. Windows & DOS: Issues & Discussions

Memory Issue

Hi There, I have upgraded the DELL poweredge 2600 server memory from 2GB to 4GB. However, the memory only showed at 2GB of utilization. How to make sure that the server is full utilize of 4GB of memory. Is there the Virtual memory need to be reconfigure as this server is run on windows 2000 and... (2 Replies)
Discussion started by: vestro
2 Replies
Login or Register to Ask a Question