Hi Paul.

On Wed, 13 Nov 2013 20:29:45 +0400, Paul Fertser wrote:
> On Mon, Nov 11, 2013 at 02:55:11PM +0100, Jens Bauer wrote:
>> I know on some systems, malloc can't handle buffers larger than 1MB.
> 
> Do you mean some embedded ones? Still that limitation sounds way too
> strange for any memory allocator I can think of.

Yes, completely stupid limit; it doesn't fit anything logical, except that the 
memory block descriptor might always be allocated on a 16-byte boundary and 1MB 
is 65536 16-byte boundaries.
It's been a while now, but I do remember the error message came from a 
command-line.
I remember that I tried 1024*1024 bytes: failed, but 1023*1025 bytes succeeded.
I just tested it on my Mac OS X, and it seems to work here (it might not work 
if I turn VM off, though).

Embedded systems would probably not run OpenOCD from anything but Linux.
But if the device can't handle virtual memory / memory protection, it might not 
be able to allocate such large blocks.

Besides, the executable on my platform is around 2.5MB, so if the platform is 
able to run OpenOCD in the first place, wouldn't it be able to allocate blocks 
of those sizes ?

>> But sometimes I also use daisy-chaining (eg. pointer to 'next', plus 
>> a 'length' field in the beginning).
> 
> LwIP does something like that with pbufs, yes, forcing one to always
> use special functions to search or extract substrings. In the LwIP
> case this strategy makes a lot of sense, as it allows to avoid memory
> fragmentation and provides more predictable execution environment.

If all blocks allocated are the same size, there will be no real reason for 
memory fragmentation, plus cleaning up / finding new blocks will be very fast.
14 years ago I worked in a company, where I sped up the application using this 
technique. The results were amazing.
...But that's probably a completely different subject.


Love
Jens

------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to