home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!jvnc.net!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!tamsun.tamu.edu!tsmith
- From: tsmith@cs.tamu.edu (Todd M Smith)
- Newsgroups: comp.lang.c
- Subject: good memory allocation strategies?
- Message-ID: <1992Jul21.214115.28569@tamsun.tamu.edu>
- Date: 21 Jul 92 21:41:15 GMT
- Sender: news@tamsun.tamu.edu (Read News)
- Reply-To: tsmith@cs.tamu.edu
- Organization: Computer Science Department, Texas A&M University
- Lines: 40
-
-
- I thought that perhaps this would be a FAQ, but I couldn't find it in
- the FAQ.
-
- I am working on a moderate size (~10000 lines so far) system on an SGI
- workstation running UNIX system V.3, and I am wondering about some
- memory allocation issues. Here are the two situations I am dealing
- with.
-
- 1) I have need for a lot of variable-size data structures (lists of
- items), so I currently have linked lists running all over the place.
- 2) Soon, I might also need to use large contiguous blocks of space,
- but the size of these can change also.
-
- I guess this is a common trade-off. I don't really want to limit the
- user by using arrays that I "think" are bigger than they will need.
- But dynamic stuff can be a pain sometimes, and I don't want to slash
- up the memory.
-
- So I need some information on the following questions:
-
- 1) Is it reasonable (in general) to ask the user to live with a big
- limit?
- 2) How much of a speed penalty does dynamic allocation really impose?
- 3) How serious of a problem can memory fragmentation be on a modern
- workstation?
- 4) If dynamic allocation is used, what is the best strategy for
- handling blocks of memory whose sizes change, i.e., initially
- overallocating, constantly realloc()ing, keeping track of unused
- space, writing your own complete memory management system :-),
- etc.?
-
- If there are other pertinent issues that I have left out, please
- include them too. Thanks in advance.
-
-
- Todd Smith
- --
- Todd Smith tsmith@cs.tamu.edu
- Life is a word problem.
-