* "unaligned access" in malloc()
@ 1996-02-14 5:00 Kevin Weller
1996-02-15 5:00 ` Bruce Milner
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Kevin Weller @ 1996-02-14 5:00 UTC (permalink / raw)
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
--
------------------------------------------------------------------------------
Kevin L. Weller, a.k.a. Crewman!!! /-------+--------------------\
crewman@netcom.com | aTm | GIG 'EM, AGGIES! |
This is my personal (non-business) account \-------+--------------------/
------------------------------------------------------------------------------
%SYS-E-BADOPSYS, Fatal system error, DEC VMS halting \ All wiyht. Rho sritched
-SYS-I-GETUNIX, Replace with UNIX immediately! \ mg kegtops awound?
------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: "unaligned access" in malloc()
1996-02-14 5:00 "unaligned access" in malloc() Kevin Weller
@ 1996-02-15 5:00 ` Bruce Milner
1996-02-16 5:00 ` Carl J. Appellof
1996-02-20 5:00 ` Kevin Weller
2 siblings, 0 replies; 6+ messages in thread
From: Bruce Milner @ 1996-02-15 5:00 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: "unaligned access" in malloc()
1996-02-14 5:00 "unaligned access" in malloc() Kevin Weller
1996-02-15 5:00 ` Bruce Milner
@ 1996-02-16 5:00 ` Carl J. Appellof
1996-02-20 5:00 ` Kevin Weller
2 siblings, 0 replies; 6+ messages in thread
From: Carl J. Appellof @ 1996-02-16 5:00 UTC (permalink / raw)
crewman@netcom.com (Kevin Weller) wrote:
>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
>
Could your program be free()ing a pointer that didn't originally come
from malloc() ? All sorts of weird things can happen if you do that,
depending on malloc/free implementation.
--
Carl Appellof
not speaking for
Digital Equipment Corporation
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: "unaligned access" in malloc()
1996-02-14 5:00 "unaligned access" in malloc() Kevin Weller
1996-02-15 5:00 ` Bruce Milner
1996-02-16 5:00 ` Carl J. Appellof
@ 1996-02-20 5:00 ` Kevin Weller
1996-02-21 5:00 ` Mark Charette
2 siblings, 1 reply; 6+ messages in thread
From: Kevin Weller @ 1996-02-20 5:00 UTC (permalink / raw)
Well, I found the problem and fixed it...turns out, a buffer was being
freed twice in a chain execution of virtual destructors. <sheepish
grin> I usually know better than to suspect the library, but then,
I'd been searching my code for days, with no luck, and any C
programmer knows what that can do to someone's sanity.
Despite my embarrassment, I must say that the good folks at DEC sure
buried the "atom" toolkit deep. It's man pages weren't included in
the standard places, so I had absolutely no idea it existed. Only
after someone with Digital tech support mentioned it, along with
several nice people via email, did I actually know of it...but not
even the DEC tech could tell me where the documentation was or how to
use it! I wound up searching the entire "dxbook" CD-ROM for
references to the word "atom", finally turning up some documentation
on where the stuff is and how to use it. But it was too late, since I
found and used Gray Watson's dmalloc library to track down the
problem. I think I'll have my boss make a donation to Mr. Watson;
dmalloc is worth it.
Thanks to all who responded to my pleas during my hour of crisis.
Shamefully,
Kevin
Kevin Weller (crewman@netcom.com) wrote:
: 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 L. Weller, a.k.a. Crewman!!! /-------+--------------------\
crewman@netcom.com | aTm | GIG 'EM, AGGIES! |
This is my personal (non-business) account \-------+--------------------/
------------------------------------------------------------------------------
%SYS-E-BADOPSYS, Fatal system error, DEC VMS halting \ All wiyht. Rho sritched
-SYS-I-GETUNIX, Replace with UNIX immediately! \ mg kegtops awound?
------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: "unaligned access" in malloc()
1996-02-20 5:00 ` Kevin Weller
@ 1996-02-21 5:00 ` Mark Charette
1996-02-28 5:00 ` Linda Sue Wilson USG
0 siblings, 1 reply; 6+ messages in thread
From: Mark Charette @ 1996-02-21 5:00 UTC (permalink / raw)
Kevin Weller wrote:
>
> Despite my embarrassment, I must say that the good folks at DEC sure
> buried the "atom" toolkit deep. It's man pages weren't included in
> the standard places, so I had absolutely no idea it existed. Only
> after someone with Digital tech support mentioned it, along with
> several nice people via email, did I actually know of it...but not
> even the DEC tech could tell me where the documentation was or how to
> use it! I wound up searching the entire "dxbook" CD-ROM for
> references to the word "atom", finally turning up some documentation
> on where the stuff is and how to use it. But it was too late, since I
If you go into /usr/.smdb. and grep through the *.inv files for
things like *.ps and *.txt you'll find where the release
notes and such are buried along with what subsets they're in. The
*.inv files are the "inventory" files for the currently loaded and
"not loaded but looked at" subsets. I look in there pretty often to
a) find out where libraries are loaded from so I can get the right
subset installed.
b) reload a library from the CD-ROM if it gets corrupted for any reason
c) snoop around looking for release notes so I don't waste my time
trying to fix documented bugs.
d) find out where all the related files for a tool are loaded.
setld will sometimes tell you where the release notes are when the
subset is loaded, but many times a sysadmin is the one who loads the
subset and they probably can't tell everyone where the release notes
are.
--
Mark Charette "Languages come; languages go--only Fortran is for
Mika Systems, Inc the ages." - Jim Glass
charette@mika.com http://www.mika.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: "unaligned access" in malloc()
1996-02-21 5:00 ` Mark Charette
@ 1996-02-28 5:00 ` Linda Sue Wilson USG
0 siblings, 0 replies; 6+ messages in thread
From: Linda Sue Wilson USG @ 1996-02-28 5:00 UTC (permalink / raw)
To: lsw
>Kevin Weller wrote:
>>
>> Despite my embarrassment, I must say that the good folks at DEC sure
>> buried the "atom" toolkit deep. It's man pages weren't included in
>> the standard places, so I had absolutely no idea it existed. Only
>> after someone with Digital tech support mentioned it, along with
>> several nice people via email, did I actually know of it...but not
>> even the DEC tech could tell me where the documentation was or how to
>> use it! I wound up searching the entire "dxbook" CD-ROM for
>> references to the word "atom", finally turning up some documentation
>> on where the stuff is and how to use it. But it was too late, since I
The Atom toolkit shipped as an Advanced Developer's Kit on Digital Unix
3.0 and later systems. It will be supplied as a fully supported product
on Digital Unix 4.0.
Because Atom was not a fully supported product on earlier Digital Unix
systems, it was supplied as an optional subset on the base operating
system CD. The subset name is ATMBASE3??, where ?? depends on the
operating system release. The subset contains reference pages and
several manuals as postscript files.
The ADK contains a prototype version of the Atom software and
documentation. Because it wasn't fully supported, documentation on
the kit's availability was limited to the release notes that
shipped with the system.
In Digital Unix 4.0, to be released in the near future, the reference
pages for Atom are included with other base system documentation.
Also, the Programmer's Guide has been updated to contain new chapters
on building Atom tools and the Atom tools that are packaged with the
OSFSDE (Development Environment) subset.
I realize this information is too late to help with the C++ problem,
but hopefully it will be of use to you in the future.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1996-02-28 5:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-02-14 5:00 "unaligned access" in malloc() Kevin Weller
1996-02-15 5:00 ` Bruce Milner
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox