1753905 Members
9782 Online
108810 Solutions
New Discussion юеВ

memory problem

 
Michael Doyle_1
New Member

memory problem

We have a multithreaded application. On startup, one thread loads a large amount of data (~600MB) onto the heap. Some time later, another thread frees up the memory and then re-loads the data onto the heap. This causes a large increase in the process size, but mallinfo() tells us that this is entirely due to unused blocks on the free list - in other words, the extra memory is being wasted.

In more detail:

After the data has been loaded initially, memorymap() tells us the situation is as follows:

Arena 0: Free = 100KB, Used = 115MB, Small Blocks = 472MB (of which 469MB is in use according to mallinfo()).
Arena 1: Free = 123KB, Used = 30KB, Small Blocks = 370KB
All other arenas are unused.

After the data has been freed and reloaded, the situation is like this:

Arena 0: Free = 46MB, Used = 70MB, Small Blocks = 472MB (of which 170MB is free)
Arena 1: as before
Arena 2: Free = 1KB, Used = 45MB, Small Blocks = 170MB
All other arenas are unused.

As can be seen, ~216MB is being held in the free lists in Arena 0. This is wasting memory and causing us problems.

Cheers,

2 REPLIES 2
Kent Ostby
Honored Contributor

Re: memory problem

Are you using the same low level routines to do the memory mapping in both process 1 and process 2 ?

I'd check to make sure those are coded the same for starters.

What OS are you running ? What memory map patches do you have (i.e. swlist -l product | grep mmap ) ?

"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
Michael Doyle_1
New Member

Re: memory problem

Hi Kent,

we are using hp-ux 11.0

output swlist -l product | grep mmap is

PHKL_22677 1.0 fix of getdirentries, MVFS, rcp, mmap & I
DS
PHKL_25813 1.0 Cumulative mmap fixes
PHKL_27207 1.0 mmap of a java JAR file on CDROM fails
PHKL_27813 1.0 POSIX AIO;getdirentries;MVFS;rcp;mmap/IDS



thanks

Regards Michael