Forum Discussion
Altera_Forum
Honored Contributor
19 years ago --- Quote Start --- originally posted by sdhnain@May 30 2006, 11:01 AM hi,
--first thing :u try to allocate 2048 of unsigned char which is equal to 2 mb, i think it's to much ! regardless your ram size ?
--seconde thing : to know that malloc() succeded u must do a test like :
if (p =! null) then ...
so i advice u to reduce the allocation size (something like 512 bytes). http://forum.niosforum.com/work2/style_emoticons/<#emo_dir#>/rolleyes.gif
best regards.
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=15693)</div> --- Quote End --- Well I sure hope 2K bytes isn't 2 MB, I believe that would be 2 KB. Regardless, no matter what amount I try and malloc() uClinux reboots. Note that when I "inline" the code into a single .c file, everything works just fine, which leads me to believe that this is a linker problem of some sort. Also, I am aware that I should be checking the value of the returned pointer from malloc(), but in the second case (test_malloc.c and foo.c), I never even get that far, my board resets (seg faults?) right when the call to foo() is made. -SQ