view lphobos/std/outofmemory.d @ 825:a70ddd449e7d

Commented some logging that could be '''very''' long, cuts -vv output size of a gtkd gl sample down 1.2GB by 3/4. Fixed wrong pointer type for multidimension "deep" slicing.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Thu, 04 Dec 2008 16:11:09 +0100
parents 88e23f8c2354
children
line wrap: on
line source

/**
 * Macros:
 *	WIKI=Phobos/StdOutOfMemory
 * Copyright:
 *	Placed into public domain.
 *	www.digitalmars.com
 */


module std.outofmemory;

/******
 * This exception is thrown when out of memory errors happen.
 */

class OutOfMemoryException : Exception
{
    static char[] s = "Out of memory";

    /**
     * Default constructor
     */
    this()
    {
	super(s);
    }

    char[] toString()
    {
	return s;
    }
}

extern (C) void _d_OutOfMemory()
{
    printf("Out of memory!\n");
    *(cast(int*) 0) = 0;
    throw cast(OutOfMemoryException)
	  cast(void *)
	  OutOfMemoryException.classinfo.init;
}

static this()
{
}