Hello Geoff,

memory is allocated by the following native routines:

static int *new_intArray(int nelements) {
  return (int *) calloc(nelements,sizeof(int));
}

static double *new_doubleArray(int nelements) {
  return (double *) calloc(nelements,sizeof(double));
}

Null is returned if memory available to calloc is exhausted. Cf.
http://www.cplusplus.com/reference/clibrary/cstdlib/calloc/

Increasing the Java heap is counterproductive as the memory assigned
to the Java heap is not available for the native library.

Do you need all 27+ instances? Consider reusing an old instance.

Consider calling the delete method of SWIGTYPE_p_double or
SWIGTYPE_p_int to avoid waiting for the garbage collection.

static void delete_intArray(int *ary) {
  free(ary);
}

static void delete_doubleArray(double *ary) {
  free(ary);
}

Best regards

Xypron


Geoff Whittington wrote:
Hello,

Can someone share under what circumstances I might get a null when calling:

SWIGTYPE_p_double val;

val = GLPK.new_doubleArray( objectiveCount );  // where objectiveCount
is an integer>0

// val == null

I am getting the same behaviour using the GLPK.new_intArray. This only
happens after calling the method about 27 times. I have upped the VM
memory and I get no Java exceptions.

Thanks in advance,
  - Geoff


_______________________________________________
Help-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-glpk




_______________________________________________
Help-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to