Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: bruce@st-pauli.genetics.utah.edu (Bruce Milner)
Subject: Re: "unaligned access" in malloc()
Date: 1996/02/15	[thread overview]
Message-ID: <BRUCE.96Feb15140522@st-pauli.genetics.utah.edu> (raw)
In-Reply-To: crewmanDMsCrv.JrE@netcom.com

In article <crewmanDMsCrv.JrE@netcom.com> crewman@netcom.com (Kevin Weller) writes:

>   Well, folks, I've RTFM'd until I'm blue in the face, but nothing seems
>   to address this problem. <sigh>
>
>   I've got a program that uses free store pretty heavily.  I compile it
>   with G++ 2.7.0, as I have done for weeks.  Now, however, after so many
>   uses of malloc() [as called from operator new, but the problem shows
>   up even if I switch to direct malloc() and free() usage], it bombs
>   with:
>
>   Unaligned access pid=13346 <a.out> va=6174616400160011 pc=3ff800cdce0
>   ra=300018406cc type=stq
>
>   The debuger (gdb) shows that this occurs *inside* malloc(), *before*
>   it ever returns to the caller.
>
>   It's my understanding that G++ new and free use the malloc() out of
>   DEC's standard C library, so I'm not sure if it's a problem with the
>   DEC malloc() or the G++ environment...hence the crossposting.  Not
>   having the source to malloc(), I can't exactly debug it myself.
>
>   Does anybody know what's going on here, or if there is a patch for
>   malloc() or gcc?  Thanks!
>
>   -Kevin


A simple program like this can generate those type of messages.
I suspect that you are freeing memory you don't own or are trying
to free part of a block of memory. 

#include <stdio.h>
#include <stdlib.h>
 
 
main(int argc, char **argv)
{
        char *mem;
        char *mem2;
 
        mem = malloc(10);
        free (&mem[2]);    /* free unallocated memory - messes up heap */
        mem2 = malloc(10);
}

On the DEC Alpha machines we have here, it generates:

Unaligned access pid=30307 <a.out> va=1400028fa pc=3ff800cd4c8 ra=3ff8010dae4 type=ldq
Unaligned access pid=30307 <a.out> va=1400028e2 pc=3ff800cd820 ra=3ff8010dae4 type=ldq

-Bruce

Bruce.Milner@genetics.utah.edu



  reply	other threads:[~1996-02-15  5:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-02-14  5:00 "unaligned access" in malloc() Kevin Weller
1996-02-15  5:00 ` Bruce Milner [this message]
1996-02-16  5:00 ` Carl J. Appellof
1996-02-20  5:00 ` Kevin Weller
1996-02-21  5:00   ` Mark Charette
1996-02-28  5:00     ` Linda Sue Wilson USG
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox