Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cunixf.cc.columbia.edu!sol.ctr.columbia.edu!caen!uflorida!reef.cis.ufl.edu!jdb From: jdb@reef.cis.ufl.edu (Brian W.K. Hook) Newsgroups: comp.lang.c Subject: malloc and stuff Message-ID: <25576@uflorida.cis.ufl.EDU> Date: 26 Nov 90 03:32:14 GMT Sender: news@uflorida.cis.ufl.EDU Distribution: usa Organization: UF CIS Dept. Lines: 11 Small question....how does a C compiler or an operating system (whichever is responsible) handle "memory fragmentatino". Assume, for instance, that you allocate 200 1K blocks of memory. Then you free() every other block, so that you 1K allocated, then 1K not, etc....Now, if all you have is 200K available to your system, and you allocate now a 100K block (since you theoretiocally have 100K available), wouldn't pointer arithmetic really get screwed up? Eg.. *(block2+1) wouldn't return something expected, would it....or does the C compiler automatically generate code that compresses memory. But if that is the case, what if you use absolute addressing? Or would it just say that you can't allocate that 100K block at all since it isn't contiguous?