dsss build, tango, GC ?

Jacob Carlborg doob at me.com
Wed Jun 9 12:30:28 PDT 2010


On 2010-06-09 21:16, Fred Burton wrote:
> Hi, I have (sort of) 2 questions:
>
> Background:
> I was doing some coding using Phobos, and recently switched to using Tango.
>
> 1. I'm trying to build using dsss and it says :
> /usr/bin/ld: cannot find -lphobos
> collect2: ld returned 1 exit status
> --- errorlevel 1
> Command /usr/bin/rebuild returned with code 65280, aborting.
> Error: Command failed, aborting.

You have to change your default rebuild configuration file. It's located 
in /etc/rebuild/default on Posix systems. Change the "profile" value to 
"dmd-posix-tango". Looking at the "dmd-posix" file, you can see, in the 
link section, that it explicitly links to "phobos" which is not 
necessary (at least not anymore). That's why you get the linker error.

> Then I have a shellscript that links all the object files that dsss produced together :
> cd dsss_objs/D
> dmd -v *.o -L-ldl ~/d/lib/libDerelictSDL.a  ~/d/lib/libDerelictSDLImage.a
> ~/d/lib/libDerelictGL.a ~/d/lib/libDerelictGLU.a ~/d/lib/libDerelictUtil.a
> /usr/lib/libSDL_image.a
>
> Which outputs:
>
> gcc flb.gui.boxmaker.o flb.gui.fontdata.o
> ...
> tango.core.Array.o tango.core.BitManip.o tango.core.Exception.o tango.core.Memory.o
> tango.core.Thread.o tango.core.tools.Demangler.o tango.core.tools.LinuxStackTrace.o
> tango.core.tools.StackTrace.o tango.core.tools.TraceExceptions.o tango.core.Traits.o
> tango.io.Console.o tango.io.device.Conduit.o tango.io.device.Device.o tango.io.device.File.o
> tango.io.model.IConduit.o tango.io.stream.Buffered.o tango.io.stream.Iterator.o
> tango.io.stream.Lines.o tango.stdc.config.o tango.stdc.ctype.o tango.stdc.errno.o
> tango.stdc.inttypes.o tango.stdc.locale.o tango.stdc.posix.config.o tango.stdc.posix.dlfcn.o
> tango.stdc.posix.fcntl.o tango.stdc.posix.inttypes.o tango.stdc.posix.langinfo.o
> tango.stdc.posix.poll.o tango.stdc.posix.pthread.o tango.stdc.posix.pwd.o
> tango.stdc.posix.sched.o tango.stdc.posix.semaphore.o tango.stdc.posix.signal.o
> tango.stdc.posix.stdlib.o tango.stdc.posix.sys.mman.o tango.stdc.posix.sys.select.o
> tango.stdc.posix.sys.stat.o tango.stdc.posix.sys.time.o tango.stdc.posix.sys.types.o
> tango.stdc.posix.sys.wait.o tango.stdc.posix.time.o tango.stdc.posix.ucontext.o
> tango.stdc.posix.unistd.o tango.stdc.signal.o tango.stdc.stdarg.o tango.stdc.stddef.o
> tango.stdc.stdint.o tango.stdc.stdio.o tango.stdc.stdlib.o tango.stdc.string.o
> tango.stdc.stringz.o tango.stdc.time.o tango.sys.Common.o tango.sys.consts.errno.o
> tango.sys.consts.fcntl.o tango.sys.consts.unistd.o tango.sys.linux.consts.errno.o
> tango.sys.linux.consts.fcntl.o tango.sys.linux.consts.unistd.o tango.sys.linux.epoll.o
> tango.sys.linux.linux.o tango.text.convert.DateTime.o tango.text.convert.Float.o
> tango.text.convert.Format.o tango.text.convert.Integer.o tango.text.convert.Layout.o
> tango.text.convert.Utf.o tango.text.locale.Data.o tango.text.locale.Posix.o tango.text.Util.o
> tango.time.chrono.Calendar.o tango.time.chrono.Gregorian.o tango.time.Clock.o
> tango.time.Time.o tango.time.WallClock.o tango.util.log.AppendConsole.o
> tango.util.log.Config.o tango.util.log.LayoutDate.o tango.util.log.Log.o
> tango.util.log.model.ILogger.o tango.util.log.Trace.o -o flb.gui.boxmaker -m32 -ldl -Xlinker -
> L/usr/lib ~/d/lib/libDerelictSDL.a ~/d/lib/libDerelictSDLImage.a ~/d/lib/libDerelictGL.a
> ~/d/lib/libDerelictGLU.a ~/d/lib/libDerelictUtil.a /usr/lib/libSDL_image.a -ltango-dmd -
> lpthread -lm
>
> And this generates a binary file which seems to work.
>
> However, it leaks memory as if the GC is not actually working at all. (I have some word wrap
> code that allocates dynamic arrays and returns them to the caller .. which has them in a local
> variable and later discards them)
>
> Valgrind reports that as a leak ...
>
> If I manually delete some intermediate arrays, it leaks less...
>
> Isn't the GC supposed to be able to free the memory?

I think that the GC doesn't give back memory to the system. It keeps it 
for future use.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list