help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Getting null when calling GLPK.new_doubleArray


From: Xypron
Subject: Re: [Help-glpk] Getting null when calling GLPK.new_doubleArray
Date: Tue, 16 Mar 2010 21:02:31 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100205 SeaMonkey/2.0.3

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
address@hidden
http://lists.gnu.org/mailman/listinfo/help-glpk






reply via email to

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