Mail Archives: djgpp/1999/06/10/06:39:05
On Thu, 10 Jun 1999, Dlanor Blytkerchan wrote:
> I downloaded a package containing sources of all kinds of foolish programs.
> I don't recall what it was called, but it was described as "test sources"
> and unpacked into a directory called DJGPP/TESTS.
Oh, that would be djtst202.zip. It's a test suite for the library
functions. The only programs that could be relevant for you in that
package are those which test malloc, but there are no such programs
in djtst yet. Anyway, your problem doesn't seem to be a simple one
which would be detected by a general-purpose test program. It's
some subtle detail, not a general problem, or so it seems.
> // if (rc) rc = ((buffer = malloc(sizeof(bufferType))) != NULL); // old
> if (rc) rc = ((buffer = malloc(34 * 1024)) != NULL); // new
Are you sure that "sizeof(bufferType)" indeed returns 34*1024? I suggest
to try to recreate the call to malloc as close as possible to the
conditions where it fails. Sometimes adding 1 byte to a request might
change the effect dramatically, especially if some obscure bugf is
involved here.
Don't forget that the compiler inserts padding between struct members, so
it's not always trivial to compute the total length. sizeof will tell you
exactly.
> I've "heard" a lot about this Emacs, just not what it's for ;-)
> I'd be interested in taking a look at the source
Feel free to do that, but I don't recommend doing it as an efficient way
of attacking this problem. Emacs sources total more than 200,000 lines
of C, and that's only for the primitives (the rest is in a special
dialect of Lisp), so reading all of it just to find what does it do
differently with memory allocation would be a terrible waste of time.
(Needless to say, I didn't write Emacs, I just help to maintain a small
part of it.)
> Is it available somewhere (on an FTP site)?
ftp://ftp.gnu.org/gnu/emacs/emacs-20.3.tar.gz
- Raw text -