[Top][All Lists]

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

[Help-glpk] xmalloc, thread-safety

From: Hruby Martin
Subject: [Help-glpk] xmalloc, thread-safety
Date: Wed, 29 Aug 2007 19:01:09 +0200 (CEST)

Hello Andrew,

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? I modified the library code:

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

( xfree similarly) and my testing program works fine, 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?

char *mpo = xcalloc(sum_of_all_doubles, sizeof(double)))

and for example:

spx->lb = mpo + ...;

Or even better? ;-)

thanks for your help


reply via email to

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