Forums: Regarding Memory Management - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Regarding Memory Management Regarding memory management

#1 User is offline   alfredhitchcock_007 

  • Private
  • Icon
  • Group: Members
  • Posts: 14
  • Joined: 01-September 03

Posted 06 September 2004 - 09:13 PM

You might seem that this is problem is silly. But i have serious doubts on this
I have created a small basic program in c. Its just a declaring a character array of one. When i see the assembly code it allocated memory of 0x8. Now i increase the character array to two bytes, the memory that is allocated is 0x8. Now again i increase the character to 3 bytes, the memory that is allocated is 0x18. Now here the real fun comes, when declaring character array of 4 bytes the memory allocated is 0x8. Can anybody tell me how is this possible.

Following is the text file attached with this

Attached File(s)

  • Attached File  First.txt (4.68K)
    Number of downloads: 38

0

#2 User is offline   nihoho 

  • Private
  • Icon
  • Group: Members
  • Posts: 11
  • Joined: 02-February 04

Posted 08 December 2004 - 09:54 AM

As far as i can tell, it just boils down to how gcc translates c into opcodes. Heuristics are involved, and also gcc by default tries to optimize your code, so these may be some good points to start researching. Try compiling with as much 'features' off as you can.. See what that gets you..
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users

  • Share



Our Sponsors:


SwiftLayer Affiliate Web Hosting