I have question about memory allocation.
I have a trouble when I run a C program.
My C program has several big double pointer(** var) variables to
structure data like 4 by 5000000.
It is supposed to calculate those varibles with different parameters
repeatedly with same size of variables.
When it is running, the first several run is fine
But it uses more and more memory, is used up all the main memory
and swap memory and is stop.
I am pretty sure that I free every variable for each run using free().
My questions are,
1. if the process needs more memory space even though every
variables are released with free().
2. How can I check if there is memory leak?
3. Would it be better if big variables breaks down to smaller size
variables.
Any suggestions and helps would be very appreciated.
Thanks,
Chang Byun 4 2707
Chang Byun wrote: I have question about memory allocation.
I have a trouble when I run a C program. My C program has several big double pointer(** var) variables to structure data like 4 by 5000000.
That's 20,000,000 per shot. If the vars are (say) doubles, it's
likely to be 160 Megabytes a shot. Divide this into the target
machine's RAM to see how many such arrays you can expect to get
away with. (On my computer you'd be lucky to create two such
arrays, given the RAM used up by other programs.)
It is supposed to calculate those varibles with different parameters repeatedly with same size of variables. When it is running, the first several run is fine But it uses more and more memory, is used up all the main memory and swap memory and is stop. I am pretty sure that I free every variable for each run using free().
My questions are,
1. if the process needs more memory space even though every variables are released with free().
If you're really freeing memory, that memory should be made available
for subsequent malloc() calls by your program, if the C implementation
is any good.
2. How can I check if there is memory leak?
With a memory checker such as valgrind, http://developer.kde.org/~sewardj/
(this one is for x86-linux, which may or may not suit your purposes).
--
Allin Cottrell
Department of Economics
Wake Forest University, NC
Chang Byun <by***@rpi.ed u> wrote in message news:<bm******* ****@newsfeeds. rpi.edu>... I have question about memory allocation.
I have a trouble when I run a C program. My C program has several big double pointer(** var) variables to structure data like 4 by 5000000. It is supposed to calculate those varibles with different parameters repeatedly with same size of variables. When it is running, the first several run is fine But it uses more and more memory, is used up all the main memory and swap memory and is stop. I am pretty sure that I free every variable for each run using free().
My questions are,
1. if the process needs more memory space even though every variables are released with free(). 2. How can I check if there is memory leak? 3. Would it be better if big variables breaks down to smaller size variables.
Without having a chance to look at your code, I'd say
you probably aren't free()ing the memory properly.
To check for memory leaks, you could use bcheck (and inherently
dbx) though I *think* their use is restricted to Solaris. Any suggestions and helps would be very appreciated.
Thanks,
Chang Byun
HTH.
--
Devarshi Chatterjee http://yallara.cs.rmit.edu.au/~dchatter
Thanks a lot guys for your kind reply and help.
I found my mistake.
I missed to free one temporary variable in a subroutine.
Thanks again.
Chang
Chang Byun wrote: I have question about memory allocation.
I have a trouble when I run a C program. My C program has several big double pointer(** var) variables to structure data like 4 by 5000000. It is supposed to calculate those varibles with different parameters repeatedly with same size of variables. When it is running, the first several run is fine But it uses more and more memory, is used up all the main memory and swap memory and is stop. I am pretty sure that I free every variable for each run using free().
My questions are,
1. if the process needs more memory space even though every variables are released with free(). 2. How can I check if there is memory leak? 3. Would it be better if big variables breaks down to smaller size variables.
Any suggestions and helps would be very appreciated.
Thanks,
Chang Byun
Thanks a lot guys for your kind reply and help.
I found my mistake.
I missed to free one temporary variable in a subroutine.
Thanks again.
Chang
Chang Byun wrote: I have question about memory allocation.
I have a trouble when I run a C program. My C program has several big double pointer(** var) variables to structure data like 4 by 5000000. It is supposed to calculate those varibles with different parameters repeatedly with same size of variables. When it is running, the first several run is fine But it uses more and more memory, is used up all the main memory and swap memory and is stop. I am pretty sure that I free every variable for each run using free().
My questions are,
1. if the process needs more memory space even though every variables are released with free(). 2. How can I check if there is memory leak? 3. Would it be better if big variables breaks down to smaller size variables.
Any suggestions and helps would be very appreciated.
Thanks,
Chang Byun This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: hauger |
last post by:
(DB2 V.8.1)
Hi @ll,
when i start my DB2 and my application connects and makes some SQL Tests
my system is running out of memory (UNITED LINUX 1.0) goes slow and
needs very very long time to answer my requests. When i kill my client
application all this used memory is killed so my application is not the
problem i think it is db2. My linux system(United Linux 1.0 inside DB2)
is runnning under an redhat 9 linux machine my United Linux is...
|
by: Chang Byun |
last post by:
hello,
I have a trouble when I run a C program.
It have several big pointer variables like 4 by 5000000.
The program is supposed to calculate that big variables with
different parameters repeatedly.
When process run several times, the first serveral runs are fine but
all the memory(main memory and swap memeory) is out of and
it is stop finally.
I am pretty sure that I free every variables for a each run.
|
by: Chang Byun |
last post by:
I have question about memory allocation.
I have a trouble when I run a C program.
My C program has several big double pointer(** var) variables to
structure data like 4 by 5000000.
It is supposed to calculate those varibles with different parameters
repeatedly with same size of variables.
When it is running, the first several run is fine
But it uses more and more memory, is used up all the main memory
and swap memory and is stop.
|
by: Michael B Allen |
last post by:
Hi,
I've tried to write the *simplest* memory allocator possible. I think it
would be useful in many cases such as allocating memory on stack as a
poor man's garbage collection perhaps.
I was hoping the clc crowd had some ideas for making it even simpler!
In-lined below the full program (132 lines). It's a circular singular
linked list of "cells" inspired by the one in Plauger's text
|
by: www.dir |
last post by:
I am developing C# application that every 10 seconds refreshes TreeView
control. I am using 3 custom classes for renewing the TreeView control.
And It seems that I do not free some resources, so every 10 seconds the
memory used by my application is increasing ( I was monitoring that
from task manager ) I know that because of the way Garbage Collector
works, it is not recommended to trust the task manager so I downloaded
AQtime (...
| |
by: Fernando Barsoba |
last post by:
Hi,
After following the advice received in this list, I have isolated the
memory leak problem I am having. I am also using MEMWATCH and I think it
is working properly.
The program does some calculations and stores elements in a list. After
that, a sorting algorithm is used over that list.
Two functions are called before the sorting process:
|
by: kumarmdb2 |
last post by:
Hi guys,
For last few days we are getting out of private memory error. We have a
development environment. We tried to figure out the problem but we
believe that it might be related to the OS (I am new to Windows so not
sure). We are currently bouncing the instance to overcome this error. This
generally happen at the end of business day only (So maybe memory
might be getting used up?). We have already increased the statement heap &
...
|
by: pradeep |
last post by:
Hello friends:
I have the following code,
char* MyClass::MyMethod()
{
char* ptr = new char; // space for NULL terminator
ptr = "hello";
return ptr;
delete ptr;
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |