Memory leaks and garbage collector for c++ (libgc) usage

Hi,

I'm trying to solve memory leaks tedious question in my application using the provided Sun library libgc.

I've tried to link the library dynamically using the -lgc flag, but when I run the app, it crashes almost immediately.

In the core file and in the log file gc.log I can see that probably the function which causes the application crash is gcGetCleanMemory().

Here's the content of the libgc log file:

This file contains Sun Visual Workshop Memory Monitor's messages for this program run.

gcall Build $Id$ Threads Version 3.10 for Forte C++ 5.4

gcUnixMMap: MAP_FAILED when mapping /dev/zero (fswap=3, size=65536Kb, flags=0x10)

!!! **** gcGetCleanMemory: MMAP committed failed

My OS is:

bash-2.03$ uname -a

SunOS localhost 5.8 Generic_108528-27 sun4u sparc SUNW,Sun-Fire-880

Could someone help me?

I've also tried to preload the library (export LD_PRELOAD=/opt/SUNWspro/lib/v9/libgc.so) but the result doesn't change.

Thanks

Alex

[1039 byte] By [alesimpa] at [2007-11-26 10:41:36]
# 1
Here are a few ideas (not using libgc).Use purify if you can.Get the latest Sun Studio, and use the memory access/check tools.Paul
Paul_Floyd at 2007-7-7 2:53:20 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2
HI Paul,thank you for the ideas, but I can't use purify and I can't update my Sun Studio.I started debugging the app with the sun one studio memory checker but it seems a very hard task. I question if this could be a bug due to the library or the compiler.
alesimpa at 2007-7-7 2:53:20 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 3
You are using C++ 5.4. If you can't upgrade to the latest compler, can you at least download it (it's free) and try it to see if the problem is fixed. If you can't even do that, can you provide a test case that reproduces the problem.Mukesh
Mukesh_Kapoor at 2007-7-7 2:53:20 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 4
> ... I can't update my Sun Studio.Well, you can use one Sun Studio for production and another for debugging purposes and even use only dbx from later version of Sun Studio. It is possible to install several versions on the same machine.
MaximKartashev at 2007-7-7 2:53:20 > top of Java-index,Development Tools,Solaris and Linux Development Tools...