[M3devel] malloc/free from Modula-3?
mika at async.caltech.edu
Mon Apr 18 21:05:55 CEST 2011
"Daniel Alejandro Benavides D." writes:
>ok, but are you telling this about in user threads or working ill or all th=
>reads and pthreads?
>Thanks in advance
I don't know exactly. There are certainly bad combinations of threading
implementations and memory allocators. And I'm sure it may be system
dependent as well. In any case, linking user threads with the -pthreads
version of libc is probably bad. Calling malloc willy-nilly from multiple
user threads is probably bad. Calling free, I don't know. Pthreads currently
don't work so maybe malloc works there but that doesn't help very much if
the system is anyhow unstable.
>--- El lun, 18/4/11, Mika Nystrom <mika at async.caltech.edu> escribi=F3:
>> De: Mika Nystrom <mika at async.caltech.edu>
>> Asunto: Re: [M3devel] malloc/free from Modula-3?
>> Para: "Daniel Alejandro Benavides D." <dabenavidesd at yahoo.es>
>> CC: m3devel at elegosoft.com
>> Fecha: lunes, 18 de abril, 2011 13:47
>> "Daniel Alejandro Benavides D."
>> >Hi all:
>> >the only thing you need to keep control as of CM3 is
>> concerned is the modul=3D
>> >a-3 free calls equals the number of news, that is, if
>> not is runtime error,=3D
>> Not exactly. You can't necessarily call malloc/free
>> from multiple threads.
>> This is a big problem for Modula-3 programs that call out
>> to nontrivial C code.
>> (Why don't we wrap malloc/free ourselves in a special
>> library? Linker problems
>> I suppose... and I also suppose the effort should rather be
>> on getting pthreads
>> working again than messing around with problems with user
More information about the M3devel