Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / November 2005



Tip: Looking for answers? Try searching our database.

memory corruption detecting ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lothar.behrens@lollisoft.de - 09 Nov 2005 12:39 GMT
Hi,

I have a problem with a structure (linked list), that gets corrupted,
if I use a specific shared library.
Not using them, all is fine.

I tried MallocDebug to detect something about that, but it doesn't
help.
These where the settings used in gdb:

set env MallocScribble 1
set env MallocGuardEdges 1
set env MallocStackLogging 1
set env MallocCheckHeapStart 100
set env MallocCheckHeapEach 100

Any ideas to catch memory area access if it should not be ?

Thanks, Lothar
David Phillip Oster - 09 Nov 2005 15:30 GMT
> I have a problem with a structure (linked list), that gets corrupted,
> if I use a specific shared library.
[quoted text clipped - 13 lines]
>
> Thanks, Lothar

Write a function, named "Probe", that prints a string if the linked list
is corrupt (possibly by keeping a second linked list and comparing the
two.) Put a breakpoint on Probe's print statement. Sprinkle your code
with Probe and re-run it until you pin down the offending line. Remember
that you may be able to run Probe from gdb, so you Probe inside the line.
lothar.behrens@lollisoft.de - 09 Nov 2005 20:35 GMT
I thougth about three structures to be managed. It is uncertain that
two structures
get corrupted. This way, even one is corrupted, I could use one of the
two, that are
equal.

But this may be too much work. Better would be, if there is a way to
protect the area
against unwanted access and only set read write access, when the
functions that have
to access the structure.

On Windows this would be a protection fault, I could use to detect the
point of fault.

Is there a similar way on PPC ?

Thanks, Lothar
Greg - 13 Nov 2005 13:45 GMT
> I thougth about three structures to be managed. It is uncertain that
> two structures
[quoted text clipped - 14 lines]
>
> Thanks, Lothar

Yes, read the malloc man page for the complete list of environment
malloc debug variables.

The easiest way to debug the program though is probably to use Apple's
MallocDebug application that is part of Developer tools. MallocDebug
will launch the program with the appropriate debug libraries and memory
guards and provides a complete GUI to boot.

If MallocDebug can't find the problem, then I would try the more
time-consuming and less developer-friendly command-line approach using
environment variables.

Greg
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.