|
-
February 14th, 2003, 05:21 AM
#1
Memory problem-any help is appreciated
Hi all,
Iam running an application which takes a Data File as input,formats the data & write it to an output File.I was running the application with 2MB data as input.Iam running it under both windows & Linux.
Under Linux,The memory usage shoots up and reaches a point where there is no more memory available & I have to reboot the system.
Iam using the same application with the same input under windows & there is no Memory usage shoot up.
This behaviour is showing up only in the linux system.
Threads are implemented in 2 different ways under windows & Linux.Is there any difference in stl implementation,memory management under Linux & thigs of that sort......which could be the cause.Iam just guessing all these things.
Iam just wondering what could be the cause of this problem under Linux.Any suggestion or opinion would be very much appreciated.
-
February 14th, 2003, 06:05 AM
#2
There are probably differences in the implementation and memory management in STL libraries, but both should as as safe, so the problem is probably not coming from there.
I don't know Linux enough to have any idea about the differences in the threading system.
Elrond
A chess genius is a human being who focuses vast, little-understood mental gifts and labors on an ultimately trivial human enterprise.
-- George Steiner
-
February 14th, 2003, 08:42 AM
#3
I would try looking at the areas where you're allocating memory;
use of a profiler would help. Once you see these areas, try
commenting each successive area out until your program runs.
I'm guessing that there'll be one set of operations that you can
say "Oh, this is fine on Windows, but not good on Linux". Then
you can take appropriate actions.
It's hard to know what your specific problem is without specific
details; can you reproduce this in a sample program that you can
post here? If not, can you post the source? If it's just a
conversion program, it's hopefully small?
--Paul
-
February 14th, 2003, 08:49 AM
#4
No paul,Its a pretty large program.I was just telling what it does in a single word as "Conversion program".I wont be able to reproduce it as I dont know what is the cause of this behaviour.Could I get any free software from the internet for checking ResourceLeaks under Linux.Like the "BoundsChecker" we have for windows.
Thanks
Kohinoor
-
February 14th, 2003, 09:04 AM
#5
Memory Check
There are environment variables which can be used to track the
malloc free calls. set MALLOC_CHECK_ to 1 or 2.
Recent versions of Linux libc (later than 5.4.23) and GNU libc (2.x) include a malloc implementation which is tunable via environment variables. When MALLOC_CHECK_ is set, a special (less efficient) implementation is used which is designed to be tolerant against simple errors, such as double calls of free() with the same argument, or overruns of a single byte (off-by-one bugs). Not all such errors can be proteced against, however, and memory leaks can result. If MALLOC_CHECK_ is set to 0, any detected heap corruption is silently ignored; if set to 1, a diagnostic is printed on stderr; if set to 2, abort() is called immediately. This can be useful because otherwise a crash may happen much later, and the true cause for the problem is then very hard to track down.
Another tool is mtrace from the glibc library. See docu for details.
Last edited by akraus1; February 14th, 2003 at 09:06 AM.
-
February 14th, 2003, 09:20 AM
#6
I can suggest U the program which called "valgrind".
I use it for Linux programs and it really helps to find some problems.
write "valgrind" in Google
or
http://developer.kde.org/~sewardj/ - one of the links.
It can check memory leaks too and many other things.
Hope, it helps U.
Last edited by dimm_coder; February 14th, 2003 at 09:26 AM.
"UNIX is simple; it just takes a genius to understand its simplicity!"
-
February 17th, 2003, 02:52 AM
#7
I have downloaded a file of type "valgrind-1.0.4.tar.bz2".How can I install it in my system.
How should I proceed with this file...
-
February 17th, 2003, 04:38 AM
#8
What's the problem? Like for common Linux/Unix application with source codes.
unzip it,
then
tar -xf <valgrind-package-name.tar>
then go into valgrind dir
and then
1) ./configure
2) make
3) make install
(read in INSTALL file)
then about its usage U can read in /docs folder.
Command will be something like:
(I use it)
valgrind -v --num-callers=10 --leak-check=yes --logfile-fd=10 10>logfile ./program [command line]
All this U can read in /docs/manual.html
Last edited by dimm_coder; February 17th, 2003 at 04:42 AM.
"UNIX is simple; it just takes a genius to understand its simplicity!"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|