memory leak?

memory leak?

Post by a98mi.. » Sat, 27 Apr 2002 01:52:29



Hi!
I'm currently working om my final year project but I've bumped into some
problems with an algorithm I'm implementing i C++.
After the program terminates all memory allocated isn't released by
either the program itself or the operating system. Before I executed the
program I typed
more /proc/meminfo
and it said that about 100 MB of physical memory was allocated. After
program termination meminfo stated that there was about 140 MB of
physical memory allocated. So.... about 40 MB went up in smock??
Shouldn't the operating system, Linux Mandrake 8.1 in my case, release
all memory allocted by a process, if the procces doesn't do this by it
self, when the process terminates? The program uses a memory mapped file
about 21 MB in size and a texture of about 10 MB which are both
unmapped/deallocated when before the program terminates. Does anyone
have any id what is going on? Is there any easy to use memory leak
tracker besides LeakTracker that can be used in conjunction with
new/delete?

Best regards,
/Michael Andersson

 
 
 

1. memory leaks by shared memory and fork

Hi,

i've a problem with a server-program. It consums memory and never release
the memory. Even if i kill the program the memory never comes back.

When the program starts, it allocate a bunch of RPC-client connections, and
stores them in an shared-mem region (created with mmap() PROT_READ |
PROT_WRITE, MAP_SHARED | MAP_ANON ).
When my program receives an RPC-call it calls fork(), the child takes one of
the free connections from the pool, mark it as busy, and route the RPC via
the connection to another server.
Before the child process terminates (via exit() ) it marks the connection as
free.
The parent process runs in an loop, and waits for new RPC-calls or SIGCHLD
when a child terminates.

That what makes me "unhappy" is, that every fork consum 4kb, and the memory
is never released. There is no malloc (new) after the fork.
The child only read/write the mmap-memory.
There is only a special handling for broken RPC-connections. Then the server
(in the child process) replace the broken connection with a new one. But
this happens very rare.

Has anyone a good idea whats the reason for this behavior?

Okay, the system is a RH8.0 standard installation. Nothing is patched or
changed.
I get the same results on RH7.2 or SuSE 7.3. Under Solaris 9 happens nothing
and the program works as designed!

best regards
Joerg

2. DNS starter questions

3. Sun workshop memory monitor does not detect all memory leak

4. 2.5.43 cciss factor more dup'ed code

5. 64bit solaris 2.8 memory name resolution memory leak?

6. CD Install help (SB 16/slack)

7. How can I recover memory from a memory leak

8. Linux Frequently Asked Questions with Answers (Part 2 of 6)

9. mm/memory.c, 2.4.1 : memory leak with swap cache (updated)

10. How to find out the memory size used by a process or check its memory leaking?

11. Memory Leaking. Help!

12. Memory leak in accept(), Solaris 2.5.1

13. kernel 2.0.28 and Memory Leak Problem.....