Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!mcvax!prlb2!kulcs!kulesat!esat!bartels From: bartels@haydn.kulesat.uucp Newsgroups: comp.sys.mac.programmer Subject: Creating big new handle Summary: When I create a large handle mine computer crashes Keywords: Newhandle Message-ID: <1038@haydn.kulesat.uucp> Date: 12 Apr 89 14:53:39 GMT Reply-To: bartels@kulesat.uucp Organization: Katholieke Universiteit Leuven,ESAT - dep. Elect. Engineering, Belgium Lines: 91 It don't succeed to create a large handle. The program stops, at the line image = Newhandle((long) 4096) and I had to restart the computer. Does anyone know how to acces a large amount of memory without crashing the computer. #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include typedef BitMap *BitMapPtr; main() { CWindowPtr ImagePort; CTabHandle CThan; Handle Image; Rect Imagerect; PixMapHandle ImageMap; long int i; long int refCon; CWindowRecord wRecord; InitGraf(&qd.thePort); InitFonts(); InitWindows(); InitMenus(); TEInit(); InitDialogs(nil); InitCursor(); SetRect(&Imagerect,40,40,350,350); ImagePort = (CWindowPtr) NewCWindow((Ptr) &wRecord,&Imagerect,"\pMijn eerste beeld",1, documentProc, (WindowPtr) -1 ,0,refCon = 4); while(! Button()); CThan = (CTabHandle) (NewHandle(((long) 255) * 4 + 10)); (*CThan)->ctSeed = GetCTSeed(); (*CThan)->ctFlags = 0; (*CThan)->ctSize = 256; for (i=0; i<=255; i++) {(*CThan)->ctTable[i].value = (short) i; (*CThan)->ctTable[i].rgb.red = (unsigned short) (255 * i); (*CThan)->ctTable[i].rgb.green = (unsigned short) (255 * i); (*CThan)->ctTable[i].rgb.blue = (unsigned short) (255 * 0);}; SysBeep(100); Image = NewHandle((long) 1024); for (i=0; i<=1023; i++) {*(*Image + i) = (short)((i + 1)/32);} SetRect(&Imagerect,0,0,32,32); ImageMap = NewPixMap(); SysBeep(100); (*ImageMap)->baseAddr = *Image; (*ImageMap)->rowBytes = (0x8000|32); (*ImageMap)->bounds = Imagerect; (*ImageMap)->pmTable = CThan; SysBeep(100); CopyBits(((BitMapPtr)*ImageMap),((BitMapPtr)*(ImagePort->portPixMap)), &Imagerect,&Imagerect,0,0); while(! Button()); } Thanks for your attention, Yours sincerly, Rudi Bartels KU Leuven Faculteit der Toegepaste Wetenschappen ESAT-MI2 Kard. Mercierlaan 94 3030 Heverlee Belgium email: bartels@kulesat.uucp Fax: 32-16-221855