CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Question about malloc() and PIC18F6621

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Hans Wedemeyer



Joined: 15 Sep 2003
Posts: 226

View user's profile Send private message

Question about malloc() and PIC18F6621
PostPosted: Sun May 30, 2004 7:58 pm     Reply with quote

malloc() fails to allocate 556 bytes.

The PIC18F6621 has 3840 byte of SRAM.
The project LST file shows plenty of memory available:

RAM used: 1039 (27%) at main() level
1214 (32%) worst case

I think I'm setting up correctly for using Malloc(0

From the project header file:
#include <18F6621.h>
#device *=16, adc=8
#pragma USE DYNAMIC_MEMORY
#include <STDLIBM.H>

In the help file for Malloc() the size parameter is stated to be an Integer !

Does anyone know if malloc is really limited to 255 bytes ?


from help file:
Parameters:
size is an integer representing the number of bytes to be allocated.
Guest








Reply from CCS tech support....
PostPosted: Tue Jun 01, 2004 5:08 pm     Reply with quote

Change size_t variable in stddef.h to a long instead of an int. The malloc function uses the size_t variable to determine the return type.
Thanks
CCS Tech Support
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group