IN RTOS HAVING 1OKBYTES OF MEMORY AND YOUR PROGRAMM FOR
ASKING FOR 5KBYTES AND YOU GOT NULL ERROR ? WHY DOES IT
BEHAVES LIKE THIS
Answers were Sorted based on User's Feedback
Answer / feroz ahmed
The problem is because of memory fragmentation..
Though 10KB of memory is available but it will be in
smaller chunks (less than 5KB).. when we request for 5KB
malloc returns NULL as it coudnt find a chunk of size 5KB...
Is This Answer Correct ? | 29 Yes | 0 No |
Answer / laxman.vallandas
It may be becoz of two things.
1.External Fragmentation.
2.Memory leak
Due to external fragmentation 5 kb of memory will not be
allocated even though 10 kb of memory is available because
the memory is in chunks of size less than 5 kb.so wen u try
to allocate memory since malloc returns chunks of contigous
memory ,it returns NULL.
Reason 2:
If memory is allocated dynamically may be in other files or
process and which was not been deallocated yet which
results in memory leaks .
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / ravidevroy
This might be because, you might be allocating memory
dynamically from the heap. But care is not taken to
deallocate the same.
as a result, there are memory leaks and finally the os says
that there is no free memory
Is This Answer Correct ? | 3 Yes | 9 No |
Answer / mohan
RTOS might be having 10k memory, might not fragmentation
problem, and the largest hole available to user might be
lesser than 5k, this condition might be one of the reason
for NULL error.
Is This Answer Correct ? | 0 Yes | 8 No |
Write a code to connect Hardware interrupt to ISR...?
What is priority inversion?
what do u mean by Semaphore..when v wil go for using this..explain about hat.what is the difference betw..binary ,,counting and mutex semphores
I have a situation where the programme counter(PC) shows that vxworks msgQreceive function has been called by task A and Q is full, still I am not picking up the messages. There is no other task registered to receive messages from this Q. The sending task B, which is ISR in this case, is getting timedout everytime it tries posting new message in it. A's state is PEND which means I am waiting for some resource to get free but PC shows I have called vxworks msgQReceive and currently at qJobget+0x018 location. There seems to be two causes now(identified by me): either vxworks qjobget task is not able to do semTake or no messages in Q. But Q is full and semTake failure seems unlikely(though I dont have a mechanism to check so). Besides explaining root cause for above, can anyone suggest how to get my task in READY state again? I also tried flushing the Q; on doing this, more messages get posted in Q but A still doesnt pick up any :(
what is task spawn in vxworks ?plz anyone explain me
IN RTOS HAVING 1OKBYTES OF MEMORY AND YOUR PROGRAMM FOR ASKING FOR 5KBYTES AND YOU GOT NULL ERROR ? WHY DOES IT BEHAVES LIKE THIS
what are the various methods to overcome it?
Assume there is a global variable & a static global variable.Both gets memory allocated from the data segment. Then how does the visiblity of static global varible gets limited to the file alone (in which it gets declared) ???
What is another for creating a task without using taskspawn?
Which RTOS supports Non-Preemptive scheduling ? Why other scheduling methods are supported by such Oses?
hi this is srikanth i need video classes for Vxworks any body having this forward me thanking u