Article View: comp.sys.amiga.tech
Article #13277Re: Memory allocation
From: Doug Walker
Date: Tue, 02 Jan 1990 15:57
Date: Tue, 02 Jan 1990 15:57
20 lines
1506 bytes
1506 bytes
In article <2617@jolnet.ORPK.IL.US> caw@jolnet.UUCP (Chris Wichura) writes: >1) Instead of using the char buf[1024] use a char *buf and call your > favorite memory alloc routine (ArpAlloc(), AllocMem(), malloc(), etc) > to get the storage for the buffer and then free the memory after the > copy file routine is done. This will drastically reduce the amount > of stack space your copyfile routine needs. Or, much simpler, just declare the buffer to be global (declare it outside the scope of the function, or put the 'static' keyword on it). Since you only need the buffer during the scope of the routine, this will work for your case. If you really needed a new buffer for each invocation of the routine, you would have to allocate and free each call, but in your case you don't. ***** =*|_o_o|\\=====Doug Walker, Software Distiller======================= *|. o.| || | o |// "READY! FIRE! AIM! (Software under development!) ====== usenet: ...mcnc!rti!sas!walker plink: dwalker bix: djwalker
Technical Details
Message-ID:
<1411@sas.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mcnc!rti!sas!walkerReferences:
<Dec.30.13.09.02.1989.28450@topaz.rutgers.edu> <2617@jolnet.ORPK.IL.US>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mcnc!rti!sas!walker From: walker@sas.UUCP (Doug Walker) Newsgroups: comp.sys.amiga.tech Subject: Re: Memory allocation Keywords: stack size, heap, Lattice 5.04 Message-ID: <1411@sas.UUCP> Date: 2 Jan 90 15:57:44 GMT References: <Dec.30.13.09.02.1989.28450@topaz.rutgers.edu> <2617@jolnet.ORPK.IL.US> Reply-To: walker@sas.UUCP (Doug Walker) Organization: SAS Institute Inc, Cary NC Lines: 20