Page MenuHomePhabricator

Enable context creation in preallocated memory

Authored by deadalnix on Jan 20 2020, 23:39.


  • Prepare for manual memory management in preallocated memory
    • Determine ALIGNMENT more cleverly and move it to util.h
    • Implement manual_malloc() helper function
  • Add size constants for preallocated memory
  • Switch to a single malloc call
  • Support cloning a context into preallocated memory
  • Check arguments of _preallocated functions
  • Add tests for contexts in preallocated memory
  • Export _preallocated functions
  • Move _preallocated functions to separate header
  • Explain caller's obligations for preallocated memory

This is a backport of secp256k1 PR566

Depends on D5030

Test Plan
ninja check-secp256k1

Diff Detail

rABC Bitcoin ABC
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

deadalnix created this revision.Jan 20 2020, 23:39
Herald added a reviewer: Restricted Project. · View Herald TranscriptJan 20 2020, 23:39
Fabien accepted this revision.Jan 21 2020, 16:46
Fabien added a subscriber: Fabien.
Fabien added inline comments.
17 ↗(On Diff #15695)

excepts => accepts ?

203 ↗(On Diff #15695)

I know it's just like the PR, but really this code is horrible to read...

This revision is now accepted and ready to land.Jan 21 2020, 16:46
deadalnix added inline comments.Jan 21 2020, 17:01
203 ↗(On Diff #15695)

Yes, 100%

deadalnix added inline comments.Jan 21 2020, 17:02
17 ↗(On Diff #15695)

Maybe expects ?

This revision was landed with ongoing or failed builds.Jan 22 2020, 15:25
This revision was automatically updated to reflect the committed changes.