473,770 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

memory shortage

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.

My questions are,

1. if the process is needs more memory even though the variables
have been released with free()
2. what is the best way to manage memory
3. is it better to break down a big variables into smaller variables
and run more
4. if there is memory leak, how can I find it?

Any suggestion and helps would be appreciated.

Thanks,

Chang

Nov 13 '05 #1
1 1619
Chang Byun <by***@rpi.ed u> wrote in message news:<bm******* ****@newsfeeds. rpi.edu>...
hello,
I have a trouble when I run a C program.
It have several big pointer variables like 4 by 5000000.
How have you allocated space for these variables. Static allocation not
adviced, if you use dynamic allocaton then make sure you check on the return
value. 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.
Processes, IPC are not discussed here thats off topic. But pretty sure there
is a leak somewhere !
I am pretty sure that I free every variables for a each run.
Really ..
My questions are,

1. if the process is needs more memory even though the variables
have been released with free() Use malloc/realloc() and check on the return values 2. what is the best way to manage memory 3. is it better to break down a big variables into smaller variables and run more
Depends on the need for allocation. 4. if there is memory leak, how can I find it?
Use memory diagnostics tools. Google might be of some help.
Any suggestion and helps would be appreciated.

Thanks,

Chang

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
3484
by: xixi | last post by:
hi, we are using db2 udb v8.1 for windows, i have changed the buffer pool size to accommadate better performance, say size 200000, if i have multiple connection to the same database from application server, will each connection take the memory 800M (200000 x 4k = 800 M), so the memory took will be 800M times number of connections, or the total memory get from bufferpool will be 800M?
6
2880
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...
4
2708
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.
13
5743
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
3
1128
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 (...
7
2559
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:
5
24792
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 & ...
31
1199
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;
0
9618
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10259
Oralloy
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...
0
10101
jinu1996
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...
1
10038
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,...
0
9906
tracyyun
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...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
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();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.