Archive for November, 2007

PHP: Memory leak in implicit __toString() call with certain functions

See the gory details in http://bugs.php.net/bug.php?id=43450.

Basically, there are function which expect strings and the implicit _toString() call on an object will leak memory. Testcase:

< ?php
    class Foo {
        function __toString() {
            return 'foo';
        }
    }
    for ($i = 0; $i < 1e5; $i++) {

        $o = new Foo;

        # leaks
        md5($o);
        # does not leak
        #md5($o->__toString());

        # does not leak either way
        # strstr($o, 'f');
        #strstr($o->__toString(), 'f');

        if ($i % 1e3 == 0) {
            printf("%u: %1.2f KB\n",
                $i, memory_get_usage(true) / 1024);
        }
    }

Add comment November 30th, 2007

Update2: reverse full page zoom feature without patch

In my last post I talked about a patch to reverse the behavior when  using the mouse with the control-key to use the new full page zoom in Firefox 3 beta 1. Well, it seems like there’s an obvious simple soluation already possible: just set the hidden config mousewheel.withcontrolkey.numlines to -1 instead of 1 and there you go. Now that I created a patch to Firefox for the same behavior makes me feel like using canons to shoot birds . . . anyway, I now know what it takes to build Firefox from source on Windows, might come in handy one day ;-)

Add comment November 28th, 2007

Update: Custom Firefox 3 build with “zoom.reverse”

I really couldn’t stand the zoom behavior with the mouse the way it has been changed for Firefox 3. However zooming is such a crucial part for me I want ahead, set up a custom build environment and after hours of fiddling a patch came out.

This patch honors the (hidden) preference zoom.reverse when doing the actual zooming with the mouse (mousewheel.withcontrolkey.action == 5). You can download my custom build of Firefox 3. It’s for Windows only and it’s just a zip file, no installer required. Unzip, change the hidden pref (hint: about:config) to true and there you go. You can start it along any existing Firefox version however you probably want to start it with a custom profile first with -P otherprofile so it doesn’t temper with your existing one. By default you can only run one instance of FF, if you’re sure you want to run them simultaneously, use MOZ_NO_REMOTE.

Add comment November 25th, 2007


Calendar

November 2007
M T W T F S S
« Aug   Jan »
 1234
567891011
12131415161718
19202122232425
2627282930  

Posts by Month

Posts by Category