delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/10/02:41:27

Date: Mon, 10 Aug 1998 09:39:50 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Bruno Barberi Gnecco <brunobg AT geocities DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: Trouble with many mallocs and reallocs
In-Reply-To: <35cdb08e.6406284@news3.newscene.com>
Message-ID: <Pine.SUN.3.91.980810093926.1429A-100000@is>
MIME-Version: 1.0

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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019