Date: Mon, 10 Aug 1998 09:39:50 +0300 (IDT) From: Eli Zaretskii To: Bruno Barberi Gnecco cc: djgpp AT delorie DOT com Subject: Re: Trouble with many mallocs and reallocs In-Reply-To: <35cdb08e.6406284@news3.newscene.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On 9 Aug 1998, Bruno Barberi Gnecco wrote: > Debugging it, I find that the error is exactly at the line that > allocates memory to a new line (it allocates 1 byte). I'm running > the Windows 95 DPMI server. What may be the problem? You need to supply more information to get meaningful replies. At the very least, explain what is that ``error exactly at the line that allocates memory to a new line''. Please describe what is the problem that you see under a debugger. > Is there a better way to allocate memory? Yes. The usual method is to allocate memory for the buffer, and then maintain pointers into that buffer which point to the beginning of each line. There are other methods as well. For example, an editor could be totally oblivious to the line-oriented structure of text, and instead treat it as a stream of bytes. > Can I use the DPMI functions to allocate memory directly? Yes, you can, but don't do that. It will usually get you into more trouble.