Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > memory shortage

Reply
Thread Tools

memory shortage

 
 
Chang Byun
Guest
Posts: n/a
 
      10-14-2003
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

 
Reply With Quote
 
 
 
 
Ravi Uday
Guest
Posts: n/a
 
      10-14-2003
Chang Byun <(E-Mail Removed)> wrote in message news:<bmffvm$10fa$(E-Mail Removed)>...
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stock Shortage of SPA3000 Mark UK VOIP 28 10-24-2006 09:04 AM
whats with the cisco 1801 shortage? RobR Cisco 4 12-01-2005 10:46 PM
Shortage of qualified Java programmers eglato Java 117 06-24-2005 06:43 PM
question about memory shortage Chang Byun C Programming 4 10-14-2003 06:15 PM
question about memory shortage Chang Byun C Programming 0 10-14-2003 01:01 AM



Advertisments