Linked by Eugenia Loli-Queru on Tue 8th Nov 2005 07:55 UTC, submitted by I_Use_Tooooo_Many_Names
General Development Modern memory management isn't as simple as knowing that you have 150MB of programs to run and 256MB of memory to do it in. Modern Unix-like operating systems have their own characteristics for allocating and using memory. Howard Feldman explains how this works and shows how to analyze and reduce the memory consumption of your programs, no matter what language you use.
Thread beginning with comment 57841
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE: Bah.
by on Tue 8th Nov 2005 17:14 UTC in reply to "Bah."

Member since:

Man, you are so right. Somebody had better tell every programmer for every CAD package that they don't have to load a 100Mb file. I mean c'mon when I'm working on a large solid model I like it when I have a hard drive hit to slow me down.

Sorry, couldn't resist! :-)

---I can only assume most of the rest is aimed at someone fresh out of computer studies course because only a moron would load a 100Mb file into memory and process it that way unless there was a *very* compelling reason. Its something only a new programmer would do, and I would expect any graduate to know better.

Reply Parent Bookmark Score: 0

RE[2]: Bah.
by james_parker on Tue 8th Nov 2005 19:36 in reply to "RE: Bah."
james_parker Member since:
2005-06-29

Two points:

o First, an MMU is not a panacea for memory fragmentation. Frequent memory allocations and deallocations of different sizes "randomly" can result in a process's address space resulting in the memory required for the process growing much larger than necessary. Further, much of this memory may not be paged out (depending on page sizes and memory block size), which can have a significant impact on overall memory usage.

o Second, another technique for managing contiguous memory regions is to use the mmap() function (usually implemented as a system call). This can be used both for purely private space (mapping to /dev/zero with the MAP_PRIVATE option) or for large-scale file I/O (rather than reading a large file, for example, it may be mapped into memory and accessed directly). This technique may substantially reduce fragmentation in a process's address space and (for read-only files) eliminate swap space allocation.

Reply Parent Bookmark Score: 1