[En-Nut-Discussion] NutHeapRealloc

Thiago A. Corrêa thiago.correa at gmail.com
Mon May 26 19:55:02 CEST 2008


Well, I plan on using it *smile*

It seams pro/wins.c could free some of it's memory after encoding the
string. True it's a minor piece, but there are probably others. Netbuf
comes to mind.

I'm attaching a patch with Moritz changes plus a few of my own for
further review. This also adds realloc to the crt, so user code can
use it more easily.

This still doesn't enable the shared memory or the per thread memory
allocation (requires some changes to the config to enable defines).

On Fri, May 23, 2008 at 5:20 AM, Moritz Struebe <morty at gmx.net> wrote:
> If it's going to find it's way into Nut/OS yes, but I didn't implement
> it, because I'm developing with BTnut ( http://www.btnode.ethz.ch/ ),
> which is built on top of Nut/OS but does not use nutconf, as it's
> developed for a special node. Of course you can set the defines directly
> in the code if you wish. I'm also not really expecting all the code to
> go into Nut/OS, but maybe someone wants to add snippets of it. It also
> might be reasonable to do some cleanup. But I'm not going to do this as
> long as it's not going to be used by anyone but me.
>
> Cheers
> Morty
>
> Thiago A. Corrêa schrieb:
>> Should this be configurable by nutconf?
>>
>> On Wed, May 21, 2008 at 12:59 PM, Moritz Struebe <morty at gmx.net> wrote:
>>
>>> Oh yea. I forgot to add the ifdef.
>>>
>>> You'll need to compile with the appropriate -D Options
>>>
>>> -DNUTMEM_THREAD assigns Memory to a thread.
>>> -DNUTMEM_NAMED_MEM allows you to allocate Memory with a name and access
>>> that memory after a reboot.
>>>
>>> Cheers
>>> Morty
>>>
>>> P.s.: Feel free to contact me if you need any support. Feedback is very
>>> welcome. :-)
>>>
>>>
>>> Thiago A. Corrêa schrieb:
>>>
>>>> Hi Morty,
>>>>
>>>>     Sorry for taking so long.
>>>>     I'm reviewing your patch, but I'm having some trouble compiling it. I got:
>>>>
>>>> 11:55:08: Located C:\programming\ethernut\nut\tools\win32\make.exe
>>>> C:/programming/ethernut/nut/arch/avr/os/context_gcc.c: In function
>>>> 'NutThreadCreate':
>>>> C:/programming/ethernut/nut/arch/avr/os/context_gcc.c:336: error:
>>>> 'NUTTHREADINFO' has no member named 'td_heap'
>>>> make[1]: *** [avr/os/context_gcc.o] Error 1
>>>> make: *** [all] Error 2
>>>> 11:55:10: ----- 'make all' failed with error 2 -----
>>>>
>>>>
>>>>    Perhaps there is a file missing?
>>>>
>>>> Regards,
>>>>     Thiago A. Correa
>>>>
>>>> On Tue, May 6, 2008 at 12:27 PM, Moritz Struebe <morty at gmx.net> wrote:
>>>>
>>>>
>>>>> Looks like .zip are not welcome. Here a link:
>>>>> http://wwwcip.informatik.uni-erlangen.de/~simostro/nut.zip
>>>>>
>>>>> Morty
>>>>>
>>>>> Moritz Struebe schrieb:
>>>>>
>>>>>
>>>>>> Thiago A. Corrêa schrieb:
>>>>>>
>>>>>>
>>>>>>
>>>>>>>   Is there a newer version of the  NutHeapRealloc code?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> Yes. I attached the tested one. It shouldn't be a big deal to use what
>>>>>> you like. I added quite a lot of other functions like assigning memory
>>>>>> to threads, or failing free if the dead beef is corrupted. But they are
>>>>>> ifdefed.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Kind Regards,
>>>>>>>     Thiago A. Correa
>>>>>>>
>>>>>>> On Tue, Apr 22, 2008 at 12:09 PM, Moritz Struebe <morty at gmx.net> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Ok, just ran a total of 100K malloc, realloc and free operations.
>>>>>>>>  I think my NutHeapRealloc is quite stable now. Ping me is you are
>>>>>>>>  interested.
>>>>>>>>
>>>>>>>>  Cheers
>>>>>>>>  Morty
>>>>>>>>
>>>>>>>>
>>>>>>>>  Moritz Struebe schrieb:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> Hi everyone,
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>  >
>>>>>>>>  > I've written an nutHeapRealloc(). I didn't do intense testing yet, but I
>>>>>>>>  > think it should be working. Maybe someone wants to take a look at it.
>>>>>>>>  >
>>>>>>>>  > Morty
>>>>>>>>  >
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>> _______________________________________________
>>>>> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>>>>>
>>>>>
>>>>>
>>>> _______________________________________________
>>>> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>>>>
>>>>
>>>>
>>> -------------- next part --------------
>>> An embedded and charset-unspecified text was scrubbed...
>>> Name: context_gcc.c
>>> Url: http://lists.egnite.de/pipermail/en-nut-discussion/attachments/20080521/9a952899/attachment.pot
>>> _______________________________________________
>>> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>>>
>>>
>> _______________________________________________
>> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>>
>>
>
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.txt
Url: http://lists.egnite.de/pipermail/en-nut-discussion/attachments/20080526/ca8a00f9/attachment.txt 



More information about the En-Nut-Discussion mailing list