Two annoying days

ethan on 2002-11-04T17:16:35

I'm afraid I need to hit the rewind-button. My last journal entry about resolving a memory-leak turned out to be premature. Sure, I did fix a memory-leak, but actually a non-existing one. :-/ What I free'd was the return value of "SvPV(sv)"...which, according to perlapi.pod, is a pointer to the string value of "sv". Thus I had blown up all of my Perl scalar's, oups.

I found out that there was nothing wrong with my code so none of my leaks stemmed from it. Instead the underlying mplib leaks very heavily, as I found out in hourly sessions staring into the debugger and logfiles created by dmalloc (an extremely cool thing if you are an occasional C-programmer, by the way). Even worse, the author of the mplib doesn't seem to respond to my emails (probably too ashamed;-).

I then decided to patch mplib wherever I could. I was able to close a few of the leaks, but some serious ones are still lurking around. That's why I now announce MP3::Mplib to be dead. I will skip to the id3lib which is widely enough used so I expect it to be relatively bug- and leak-free. I have to re-register the namespace but this time I'll wait till the first release is actually on my hard-disk waiting to be uploaded in a tested and non-leaking state.

But that's not too urgent. First I need to recover from memory allocating and deallocating strategies. :-)

I'll now play a little with what I read in jjohn's article. Since I am one of those preferring vim over emacs, I can't use all the listings one-by-one. Making the adaptions to vim should be a real pleasure since this time it really just involves Perl and perhaps a little Bash-scripting. :-)


id3lib

acme on 2003-01-22T20:54:25

Did you get far with the id3lib module?

Re:id3lib

ethan on 2003-01-22T21:25:06

Did you get far with the id3lib module?

Actually I never touched it because mplib's author replied to me just in time. There were quite a number of fixes to be made: resolving memory-leaks in mplib and - fixed just yesterday - an issue with (apparently) 64bit machines.

0.02 will be a rewrite from scratch eventually. My first XS attempt turned out to be a mess but after Mail::Transport::Dbx (another XS) I should be able to do things a little more intelligently.

Anyway, first I have to get rid of my cold. :-/ I don't feel like doing anything productive right now.

Re:id3lib

acme on 2003-01-23T07:54:03

Ah, ok. blech has kindly asked me to code up an id3lib module. I'm a little worried about the C++ interface as I've never coded C++ XS. I guess we'll see ;-)

Re:id3lib

ethan on 2003-01-23T09:18:50

Don't worry. id3lib also comes with a C interface so you don't have to leave familiar tracks. Checking for proper C bindings was actually the first thing I did when looking up the id3lib since I am rather reluctant towards C++/XS as well.