From: Mats B. <ma...@pr...> - 2001-08-27 17:15:58
|
While we are discussing memory stuffs here: In my QuickTime package I use NewGWorld() as follows: err = NewGWorld( &newGWorldPtr, 32, &aRect, NULL, NULL, 0 ); if (err != noErr) { err = NewGWorld( &newGWorldPtr, 32, &aRect, NULL, NULL, useTempMem ); } if (err != noErr) { panic( "Out of memory: NewGWorld failed" ); } Should I use useTempMem as the first option? Also, I use NewHandle to store compressed images which may take a lot of memory. Should I use NewHandleSys to take memory from the system heap instead? I'd like to make precaution from being stabbed in my back with memory problems. Socket code: It is sad that the socket code is in such a terrible condition, so I had a look at tclMackSock.c... I wouldn't touch it with my bare hands, it looks very messy (probably due to the MacTCP APIs). So I looked at the OpenTransport docs (1.3), and it seemed fairly straightforward until I reached page 150 or so, where it says something about "deferred interrupt time" where you can't even allocate memory... At that point I stopped reading. :-( Next, looked at the Unix channel code in tclUnixChan.c where the tcp channel driver take up about half of that file (1000 lines readable code). I got the GUSI stuff from SourceForge and found out that also MacPerl (and MacPython) uses GUSI. Wouldn't it be an idee to just get the unix channel driver code from tclUnixChan.c, link it with GUSI, and make it into an extension, just for testing? Are there any problems with this? Question from an ignorant. It makes 1000 lines instead of 2700 lines of unreadable code. Mats |