• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

allocator

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For my Bulk Allocator function how can I returns a pointer to a contiguous block of memory of at least size bytes, similar to malloc()

extra 8 bytes will be given to a header for our bulk allocated objects in the same fashion as pool allocated objects thus being freed easily

bulk_alloc() function returns a pointer to a contiguous block of memory similar to malloc().
 
Saloon Keeper
Posts: 14671
330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Uhh how about just this:
 
Rancher
Posts: 473
15
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm wondering if the 'header' is hidden from the caller? Ie. in the same way that the memory returned by malloc() at address X probably starts at X-N where N is the size of the 'header' containing information for use by the system. In which case the appropriate code (which I'm assuming should be C) might be:
But I'm guessing.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic