Hello, i am using 8052 in my project and according to datasheet the data memory is 256 bytes but in my code if i exceed 128 bytes the code is not compiled do i need to use it as x data memory? please help
Surely you can understand that if you know how much memory has been used from a fixed size pool you know how much memory is available? It's simple arithmetic.
again you talk apples I talk oranges
If you use malloc to allocate 1234 bytes, YES you know you have allocated 1234 bytes. What I am trying to state is that you do not know at the time of the malloc call if the 1234 bytea are available.
One issue I have forgotten is that with dynamic memory allocation you get one added level of indirection (one thing the '51 architecture is terrible at)
My approach to "dynamic memory allocation" for the '51 (I gladly use malloc() when coding for a PC) is to have workbuffer[] together with a flag "workbuffer in use" That way you can share the memory space and avoid more indirection than needed.
You have a good weekend too.
Erik