> I am trying to run GLPK in multi-thread way, but I discovered, that
> there is a problem with memory allocation/deallocation.

> As I know, standard malloc and free should be thread-safe. Is there
> any special reason why you implement some higher "protocol" using
> xmalloc/xfree?

Mainly for internal needs (for example, to check that no allocated
blocks are lost, etc.).

>  I modified the library code:

> void  *xmalloc(int size) {
>       return calloc(1, size);
>       ....
> }

> ( xfree similarly) and my testing program works fine,

To make glpk thread-safe you need to provide two platform-specific
routines lib_set_ptr and lib_get_ptr (see src/glplib03.c). By default
these routines store a pointer in the static memory, and currently
only a version for the windows dll is implemented.

>  but malloc takes to
> much processor time. There are many "xcalloc" in "simplex1"
> function. Is it possible to pack them all to only one xcalloc call
> with offsets?

I do not think that that would resolve the problem.


Andrew Makhorin



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

Reply via email to