Hi,
I have some modules that appear to be creating giant memory leaks due to
what I think is my faulty implementation of caching. Based on a module I
found somewhere, I put the following string at the end of a module named
Map3Space, which takes two inputs, a field, and a slicenumber. I wanted
to set it up to cache the output, so I did:

sprintf (str, "Map3Space%d", slicenumber);
out[0] = DXGetCacheEntryV (str, 0, 0, NULL);
if (out[0] == NULL)
  {
    out[0] = (Object) outfield;
    DXSetCacheEntryV (out[0], 0, str, 0, 0, NULL);
  }

The problem is that this has a memory leak of 263613 bytes when run with
a 32K point dataset (floats-- seems about right). If I eliminate the
cache lines, no such leak occurs. However, eliminating the lines also
means that if I run the network with slicenumber = 1, then go to 2, it
uses the same 20meg that the whole net requires. Going back to 1 uses
_another_ 20 meg... that doesn't seem right.

On another note-- I do a lot of memory management stuff in my modules.
Obviously, anything that's malloc'ed has to be free'd. When I do
DXNewFields for outputs, I know I can't DXDelete that field, nor any of
its components. What about when I do something like this:

posarray = (Array) DXGetComponentValue (infield, "positions");
pos_float = DXGetArrayData (posarray);

In theory, I assume all that should be created here are two pointers--
but do I need to do something to clear them?
-- 
Mike Miller
[EMAIL PROTECTED] ->
[EMAIL PROTECTED]

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to