openexr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Openexr-devel] performance problem with exrenvmap due to memory con


From: Florian Kainz
Subject: Re: [Openexr-devel] performance problem with exrenvmap due to memory consumtion
Date: Thu, 03 Jun 2004 13:08:22 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030314

Hi Axel,

I will try to reduce exrenvmap's memory footprint.

The resizeErase() method in Array2D is written the
way it is to leave the Array2D object in a usable
state if new[] throws an exception.
The 1D-array version of resizeErase() is incorrect
and should probably be fixed.  If new[] throws an
exception, _data ends up pointing to a deleted memory
block.  Code that tries to access the array after
catching the exception can't tell that the _data
pointer is invalid.
On the other hand, in exrenvmap it really doesn't
matter whether resizeErase() handles exceptions
correctly or not.  The program contains only a
single try block; if an exception is caught,
exrenvmap prints an error message and exits.

Florian


Axel Waggershauser wrote:
Hi,

I tried to convert a 400M latlong rgb half exr with exrenvmap into a
cube-map with a width of 2048, that sums up to a memory footprint for
exrenvmap of about 725M. With running a full featured X desktop and 512M
of RAM I have to rely on swapping, OK, but there are two things I found
in the code that seem to unnecessarily demand my machines capabilities:

The loop in makeCubeMap calls repetitively EnvmapImage::resize() and
EnvmapImage::clear().

1. EnvmapImage::resize() calls Array2D<T>::resizeErase() which looks
like:

    T *tmp = new T[sizeX * sizeY];
    delete [] _data;
    _data = tmp;

So it first allocates new memory and _then_ deletes the old memory.
This makes no sens to me, especially since the same method of Array<T>
makes it the other way around.

2. EnvmapImage::clear() assign 0 to all pixels, but as far as I can see
this is for no reason, since they get assigned a new value in
makeCubeMap.cpp:195 anyway. It only means that I have to swap everything
in and out three times instead of two.

Any comments on this?

Thanks,
Axel.



_______________________________________________
Openexr-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/openexr-devel








reply via email to

[Prev in Thread] Current Thread [Next in Thread]