egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MegaHal 2.7 and Eggdrop v1.6.20+bindmodecase

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Modules & Programming
View previous topic :: View next topic  
Author Message
kulpae
Voice


Joined: 13 Nov 2009
Posts: 3

PostPosted: Fri Nov 13, 2009 9:27 pm    Post subject: MegaHal 2.7 and Eggdrop v1.6.20+bindmodecase Reply with quote

Hello guys,
I just tried to run the latest eggdrop from the cvs repo and got weird memory errors from megahal module. But before (with Eggdrop 1.6.19+ctcpfix) everything worked, even megaHal.

this is what I get, when running eggdrop:
Code:
[02:15] *** ATTEMPTING TO FREE NON-MALLOC'D PTR: megahal:megahal.c (1094)
[02:15] *** ATTEMPTING TO FREE NON-MALLOC'D PTR: megahal:megahal.c (1094)
(absolutely the same message several times)
[02:15] *** ATTEMPTING TO FREE NON-MALLOC'D PTR: megahal:megahal.c (1094)
[02:15] *** MEMORY TABLE FULL: megahal:megahal.c (1275)


more about my sys:
ubuntu server 8.10 x86_64
MegaHal from here

what has changed since Eggdrop 1.6.19+ctcpfix?
The first error is really weird, since at line 1094 of megaHal.c nfree is called on a non-NULL ptr...
As I said before, the same megaHal version worked nicely with 1.6.19 (okay, I had to remove the brain in order to start eggdrop...)

hopefully someone can help me,
bb, kulpae

edit: I need the cvs revision because of the "bind out" feature...
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Fri Nov 13, 2009 9:58 pm    Post subject: Reply with quote

It's not that it's trying to nfree a null-pointer, but a memory address that was not allocated using nmalloc() (memory-tracking version of malloc()).

There's probably no major change since the 1.6.19 eggie you are experiencing, but that you have actually compiled your eggie with memory debugging enabled. It's possible they've broken the nmalloc/nfree algorithms, I suppose, but I'd have to check recent changelogs to see if they've touched that (or the global export table).
You'd find this code in src/mem.c if you'd like to have a look yourself.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
kulpae
Voice


Joined: 13 Nov 2009
Posts: 3

PostPosted: Sat Nov 14, 2009 7:34 am    Post subject: Reply with quote

Yeah, thank you!
I can start eggdrop with megahal now (but have to remove the brain anyways, trying to fix that now...).

The solution was to increase the MEMTBLSIZE constant in src/mem.c from 25000 to 100000.

Very Happy
I don't know how elegant this solution is, but it works Wink
Now I'm looking, how to start megahal with an existing brain (without removing it every time)

bb, kulpae
Back to top
View user's profile Send private message
kulpae
Voice


Joined: 13 Nov 2009
Posts: 3

PostPosted: Sat Nov 14, 2009 9:52 am    Post subject: Reply with quote

Okay, had to fix some bugs in megahal.

the solution for this warnings:
Code:

[02:15] *** ATTEMPTING TO FREE NON-MALLOC'D PTR: megahal:megahal.c (1094)


is to replace all realloc calls in megahal.c with nrealloc.

And on my system (64bit) there were also a compiler warning, that I ignored first (something like: read size parameter is bigger than buffer length).
I checked it, and found out that int has the size of 4 on my machine, but BYTE4 has the size of 8!
so I went to megahal.h and changed
Code:
#define BYTE4 unsigned long

to
Code:
#define BYTE4 unsigned int


then configured with --enable-tcl-threads,
make iconfig, make && make install. done Wink

Now I can restart the bot, without this annoying Buffer Overflow Errors.

And I've increased the MEMTBLSIZE constant again to 200000, as the megahal brain grows...

thanks for showing me the way...

bb, kulpae
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Modules & Programming All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber