swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Swarm-Support] malloc(): memory corruption


From: Paul Johnson
Subject: Re: [Swarm-Support] malloc(): memory corruption
Date: Thu, 21 Jul 2005 13:38:13 -0500
User-agent: Mozilla Thunderbird 1.0.2-6 (X11/20050513)

Here is what is happening. Your program tries to use a place in memory that has been "stolen" by some other thing, so the program does not find what it expects there.

Sometimes running the program in gdb will tell you nothing because it tells you where the program crashed, rather than helping to find the thing that stole your memory in the first place.

I found a flaw in one of my programs. I was using a graph to set the colormap, and I mistakenly thought the graph object would copy the colormap, but it did not. Instead, it just took the reference. So when the colormap was gone, the graph would try to find it again and it found crap there, and the program died. I think I posted about this problem about 3 months ago, it was a big relief to find it.

So carefully look through your code and make sure

1. every createBegin has a createEnd
2. you don't try to access objects that have been freed or droopped.
3. make sure that when you do a "set: some object" kind of thing, that "some object" is a permanent thing, not a local variable.


It has been a long time since I tried to use dmalloc to find a memory leak. It was the only program that actually worked with Obj-C code. That was then, however, it may have improved. I'm told gcc-4 even now supports Objective-C++ and all kinds of exciting things have happened. I never had good luck with the other memory check programs, but perhaps they are improved. I think FC has both checker and memtest. If you find that those things help, please write up your experience and let us (me!) know.
pj

Li An wrote:
Hi swarm colleagues,

When I run a objc-swarm program, it gives the following problem--
appreciate your help very much:

address@hidden slucesome]$ ./sluce
*** glibc detected *** malloc(): memory corruption (fast): 0x0a17ab60
***
Aborted

What is wrong and how can I fix it? I use fedora 3 and other Swarm code
like heatbugs run well.

Li
_______________________________________________
Support mailing list
address@hidden
http://www.swarm.org/mailman/listinfo/support


--
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ku.edu/~pauljohn
1541 Lilac Lane, Rm 504
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66044-3177           FAX: (785) 864-5700


reply via email to

[Prev in Thread] Current Thread [Next in Thread]