janin@tybalt.caltech.edu (Adam L. Janin) (01/19/89)
I am having a problem allocating large amounts of memory in LightSpeed C. I want to allocate a relocatable block which is larger than 32k. I get out of memory errors when I try. Calling MaxMem indicates that I have over 200k free and that my largest block is over 100k in size. I am using LightSpeed C 3.0, system 6.0.2, on a Mac II with 2 Meg of memory, multifinder, and several INITs. Anyone know what causes the 32k limit? The memory manager says that the size of a block is limited only to availible memory, and all numbers appear to be longs, although the 32k size appears to be related to the size of a signed int. Any help would be appreciated, Adam Janin janin@csvax.caltech.edu or janin@cgl.ucsf.edu
yahnke@vms.macc.wisc.edu (Ross Yahnke, MACC) (01/20/89)
In article <9154@cit-vax.Caltech.Edu>, janin@tybalt.caltech.edu (Adam L. Janin) writes... >I am having a problem allocating large amounts of memory in LightSpeed C. >I want to allocate a relocatable block which is larger than 32k. I get >out of memory errors when I try... There's no obvious reason you should have a problem doing this, HOWEVER... are you sure you're passing a long to NewHandle? If you're passing something that evals to a 1 word int, and it is larger than 32K, it will really be negative. If you then cast it to a long, it will be an immensely large number guarenteed to cause NewHandle to fail. Or something like that, hope you catch my drift... /////////////////////////////////////////////////////////////////////////// Internet: yahnke@vms.macc.wisc.edu | Everyone's happy, they're finally Bitnet: yahnke@wiscmacc(.bitnet) | all the same, cuz everyone's jumping Phonenet: (608) 262-8626 | everybody elses train. --R. Smith \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
janin@tybalt.caltech.edu (Adam L. Janin) (01/21/89)
I continue to have problems allocating more than 32k using NewPtr or NewHandle. I _do_ use longs in all my calculations. Any ideas? Adam. janin@csvax.caltech.edu or janin@cgl.ucsf.edu
beard@ux1.lbl.gov (Patrick C Beard) (01/24/89)
In article <9181@cit-vax.Caltech.Edu> janin@tybalt.caltech.edu (Adam L. Janin) writes: >I continue to have problems allocating more than 32k using NewPtr >or NewHandle. I _do_ use longs in all my calculations. Any ideas? There are so many possibilities. Let's see if we can narrow them down. 1. How much memory in your machine? 2. Finder or MultiFinder? 3. How early/late are you trying to allocate this? If you are running under MultiFinder, what is the memory size? If you are allocating the memory late in the game, you might have heap fragmentation. Please let us know more. Patrick Beard