Menu

JNI - error [ENVRNMNT8] at environment destroy

Help
2016-11-11
2016-12-09
  • Chaubert Jérôme

    Hi,

    I sometimes get the following warning/error message when I "destroy" a Java "Environment" :

    [ENVRNMNT8] Environment data not fully deallocated.
    [ENVRNMNT8] MemoryAmount = 1.
    [ENVRNMNT8] MemoryCalls = 0.

    what does this exactly mean and how can I avoid this ?

     
  • Gary Riley

    Gary Riley - 2016-11-11

    CLIPS counts the number and amount of each memory request that it makes from the operating system and updates those values each time memory is returned to the operating system. When an environment is destroyed all outstanding memory allocations are returned to the operating system and the counts are checked. If the numbers aren't zero then there's an error in the math somewhere. In this case it could be something as simple as one of the routines deallocating a string not including the end of string marker in the count. That doesn't mean there's an actual memory leak since the C allocation libraries require you to specify the size when allocating but not deallocating.

    You can simply comment out the code that generates this message, but the safer solution is to create a reproducible example that can be used to determine what's going on in the CLIPS code that's not bringing both counts back to 0.

     
  • Chaubert Jérôme

    Thanks,

    I will pay attention to this problem next time I see it.

     
  • Chaubert Jérôme

    Hi,

    It seems that the problem comes from the call to "get-region" when the region is an integer.

    the following java code :

    final Environment clips = new Environment();
    clips.load("fetch.clp");
    clips.run();
    clips.clear();
    clips.destroy();
    

    With the attached "fetch.clp" and "region.lis" give the memory error There is no problem with print-region or if the region is a regular string (not an integer).

     

    Last edit: Chaubert Jérôme 2016-12-08
  • Gary Riley

    Gary Riley - 2016-12-09

    I checked a fix into the 63x code branch, https://sourceforge.net/p/clipsrules/code/HEAD/tree/branches/63x/core/. It's also attached. There was no actual memory leak, the memory tracking count was just off. Let me know if this does not resolve your issue.

     
  • Chaubert Jérôme

    Th e fix works fine many thanks

     

Log in to post a comment.