MudBytes
» MUDBytes Community » Codebase Specific » DikuMUD » Rom » So I tried using Valgrind on ...
Pages: << prev 1, 2 next >>
So I tried using Valgrind on my Mud...
David Haley
Wizard






Group: Members
Posts: 7,841
Joined: Jun 30, 2007

Go to the bottom of the page Go to the top of the page
#16 id:60392 Posted Jan 30, 2012, 9:29 am

That's a buffer overflow: writing beyond your allocated memory space. That is not a memory leak.

I'm not sure why you're so hostile and insist on using terminology incorrectly, it's just confusing and will give people incorrect information.

But don't take my word for the definition if you don't want to... http://en.wikipedia.org/wiki/Memory_leak

"A memory leak, in computer science (or leakage, in this context), occurs when a computer program consumes memory but is unable to release it back to the operating system. In object-oriented programming, a memory leak happens when an object is stored in memory but cannot be accessed by the running code."
.........................
-- d.c.h --
BabbleMUD Project (custom codebase)
Legends of the Darkstone (head coder)
http://david.the-haleys.org
.........................

Rarva.Riendf
Wizard




Group: Members
Posts: 775
Joined: Jul 15, 2010

Go to the bottom of the page Go to the top of the page
#17 id:60393 Posted Jan 30, 2012, 9:47 am

Quote:
I'm not sure why you're so hostile and insist on using terminology incorrectly, it's just confusing and will give people incorrect information.

Considering I described how it happens I doubt it, and I call eveything memory related a memory leak anyway. (cause I use it as a water leaking analogy, not pure IT jargon).
The hostility you feel probably comes from me not being a native english speaker. Was just reminding we already have this conversation, and even if you are 'technically' right, no need to argue about it again with me, I do not care.

Last edited Jan 30, 2012, 9:48 am by Rarva.Riendf
David Haley
Wizard






Group: Members
Posts: 7,841
Joined: Jun 30, 2007

Go to the bottom of the page Go to the top of the page
#18 id:60395 Posted Jan 30, 2012, 9:54 am

It's really unfortunate that you're using incorrect terminology, and you know it's incorrect, and you don't care. :sad:
.........................
-- d.c.h --
BabbleMUD Project (custom codebase)
Legends of the Darkstone (head coder)
http://david.the-haleys.org
.........................

Rarva.Riendf
Wizard




Group: Members
Posts: 775
Joined: Jul 15, 2010

Go to the bottom of the page Go to the top of the page
#19 id:60396 Posted Jan 30, 2012, 10:00 am

I doubt it changes anything to the point I was making. Memory leaks are usually easy to fix once you detect them. Buffers overflow on the other hand....And Darien was using the term memory leak, if it was only memory leak all over the place it would be easy to detect that Valgrind pukes about that (just need to check to have top launched in a term to check).

arholly
Conjurer




Group: Members
Posts: 233
Joined: Feb 26, 2010

Go to the bottom of the page Go to the top of the page
#20 id:60397 Posted Jan 30, 2012, 10:10 am

Alright, as the OP and a newbie coder, what does it mean when you keep saying "my stack is trashed" and the like?  I understand (conceptually) what a leak is but it doesn't help me much in trying to track it down.
.........................
Owner/Coder for Project Twilight

Rarva.Riendf
Wizard




Group: Members
Posts: 775
Joined: Jul 15, 2010

Go to the bottom of the page Go to the top of the page
#21 id:60398 Posted Jan 30, 2012, 10:28 am

user error...feel free to delete

Last edited Jan 30, 2012, 10:32 am by Rarva.Riendf
Rarva.Riendf
Wizard




Group: Members
Posts: 775
Joined: Jul 15, 2010

Go to the bottom of the page Go to the top of the page
#22 id:60399 Posted Jan 30, 2012, 10:30 am

The problem is most likely not memory leaking (well considering your coding skills and the state the codebase was in when you took over, you probably have them as well, but since it crashes before you run out of of memory it is not a concern yet anyway) but buffer overflow. Read what I wrote, hoping it is clear enough. And that is a lot harder to find. You must look in Valgrind for output like:
Address 0x1BA45050 is 0 bytes after a block of size 40 alloc'd
or
Address 0x3807F7B4 is 0 bytes inside a block of size 177 free'd

Thos messages are the one you need to concentrate on. Start with the older occurence, as everything coming after may only be a result of the first buffer overflow.
The crash in itself has probably no usable information, as it can be very far away from the initial buffer overflow.

etc..

To have all the Valgrind messages in a nice view, use a front end to it. Personnaly I launch Valgrind within Eclipse, so I just have to click on an error to go through it in the code and everything stay in the same developpement environment. YMMV

Last edited Jan 30, 2012, 10:31 am by Rarva.Riendf
arholly
Conjurer




Group: Members
Posts: 233
Joined: Feb 26, 2010

Go to the bottom of the page Go to the top of the page
#23 id:60423 Posted Jan 30, 2012, 2:40 pm

Can you use the Valgrind add on in a windows environment?
.........................
Owner/Coder for Project Twilight

David Haley
Wizard






Group: Members
Posts: 7,841
Joined: Jun 30, 2007

Go to the bottom of the page Go to the top of the page
#24 id:60426 Posted Jan 30, 2012, 3:09 pm

Unless something has changed, Valgrind is a Linux-only tool. (I haven't checked in a while.)
.........................
-- d.c.h --
BabbleMUD Project (custom codebase)
Legends of the Darkstone (head coder)
http://david.the-haleys.org
.........................

arholly
Conjurer




Group: Members
Posts: 233
Joined: Feb 26, 2010

Go to the bottom of the page Go to the top of the page
#25 id:60427 Posted Jan 30, 2012, 3:14 pm

So what can I do to help track this down?
.........................
Owner/Coder for Project Twilight

Rarva.Riendf
Wizard




Group: Members
Posts: 775
Joined: Jul 15, 2010

Go to the bottom of the page Go to the top of the page
#26 id:60439 Posted Jan 30, 2012, 4:30 pm

Have a virtual image of linux where you can run Valgrind. (this is what I do)
And yes it is Linux only, the windows counterpart is Purify. I think there is a free version for non commercial use or something but never looked into it as Valgrind works fine for me)

Pages:<< prev 1, 2 next >>

Valid XHTML 1.1! Valid CSS!