Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > Standard C, C++

Reply
 
LinkBack Thread Tools Display Modes
Old 09-22-2006, 10:08 PM   #1 (permalink)
ragumrt
Registered User
 
ragumrt's Avatar
 
Join Date: Sep 2006
Posts: 2
ragumrt is on a distinguished road
i want know how to remove non use memory location

after the c compilation & run ,the memory allocation still there, how can i remove that not useful memory address ?any idea or soft available ??
pls help me ?
ragumrt is offline   Reply With Quote
Old 09-23-2006, 01:28 AM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,711
redhead is on a distinguished road
When you're done using the memory that you've created with malloc(), calloc(), realloc(), etc.. You use free() to tell the system you're done using the memory.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 09-23-2006, 10:54 PM   #3 (permalink)
ragumrt
Registered User
 
ragumrt's Avatar
 
Join Date: Sep 2006
Posts: 2
ragumrt is on a distinguished road
Quote:
Originally Posted by redhead
When you're done using the memory that you've created with malloc(), calloc(), realloc(), etc.. You use free() to tell the system you're done using the memory.
my code like

#include<stdio.h>

int main()
{
int count;
scanf("%d",&count);

retun 0;
}

after the compilation ,that memory address have null character, that is not use full for computer ,so i want remove that type not use full memory location


eg:- count variable create 2 bytes this is not use after the compilation

i think now is clear question and also cleary undear stand
ragumrt is offline   Reply With Quote
Old 09-25-2006, 09:37 AM   #4 (permalink)
toe_cutter
Code Monkey
 
Join Date: Aug 2002
Location: Boston, MA
Posts: 79
toe_cutter is on a distinguished road
Send a message via ICQ to toe_cutter Send a message via AIM to toe_cutter Send a message via Yahoo to toe_cutter
What are you using to compile? It shouldn't malloc any memory until the program is run, and then once it is finished running it will release it. You are not mallocing any memory, so you don't need to worry about freeing it. There should be no issues with your code.
__________________
toe_cutter is offline   Reply With Quote
Old 09-25-2006, 10:17 AM   #5 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,711
redhead is on a distinguished road
What toe_cutter says is correct.

Are you talking about the Assembly code for it ??
Where essentialy it is using two instructions more than nessessary ??
ie:
Code:
main:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $24, %esp
        andl    $-16, %esp
        movl    $0, %eax
        subl    %eax, %esp
        leal    -4(%ebp), %eax
        movl    %eax, 4(%esp)
        movl    $.LC0, (%esp)
        call    scanf
        movl    $0, %eax
        leave
        ret
As oppose to:
Code:
main:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $24, %esp
        andl    $-16, %esp
        leal    -4(%ebp), %edx
        movl    %edx, 4(%esp)
        movl    $.LC0, (%esp)
        call    scanf
        movl    %ebp, %esp
        xorl    %eax, %eax
        popl    %ebp
        ret
Because, then it's just a matter of compiler optimization..
Else you can write your own compiler, if you'd think it can be done even smarter.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Just wondering... destin Standard C, C++ 13 04-02-2005 06:21 PM
Accessing a specific memory address madtown54 Standard C, C++ 1 03-16-2005 05:17 AM
Problem with Memory (EXC_BAD_ACCESS) m8j Standard C, C++ 1 11-18-2004 03:50 AM
remove duplicate entries from an array? Admin PHP 3 07-14-2003 12:30 PM


All times are GMT -8. The time now is 09:20 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting