Revised interfaces for memory allocation / free methods (Comes out of rework done to support shared memory) #615
Replies: 10 comments 24 replies
-
|
@rtjohnso - First, let's settle the naming issue, as it will percolate through the rest of the discussion. I suppose you meant to say to change the name (as existing in the current change-set) of the structure from We have a convention of prefixing things in platform-land with If we go with your suggestion, it will have to become: Secondly, this handle is not just for allocation, but it's also being used for After much consideration, I had settled on I don't know how strongly you advocate to change the name for the handler structure. If you do insist that we have to reconsider and, if needed, change the name, my choices in decreasing order of preference will be:
In the rest of my responses to your proposal I will stick with |
Beta Was this translation helpful? Give feedback.
-
|
Clarifications reg. (1) Memory Allocation: As we are trying to hash-out exact interfaces, I'd like to do some detailing. Currently, the signature for allocation interfaces are these two: and, which calls this one: All the other caller-macros, such as Qs. a) I am assuming that you are ok with these The main thing to note that is different with your proposal is that all the current interfaces take a To go to your proposal, we will need That structure would change (from what it's currently in the change-set) to become: All callers to memory allocation would need to supply I would leave the Qs. b) Is this what you wanted? My thoughts: Pros of this approach:
Cons:
|
Beta Was this translation helpful? Give feedback.
-
|
Clarifications reg (2). realloc() interface: The current interface is (I agree) klunky like: which calls: If we do want to push-down
|
Beta Was this translation helpful? Give feedback.
-
|
Clarifications reg. (3) Currently the interface is like: The issue is the same as for Qs. I am assuming that's what you had in mind. |
Beta Was this translation helpful? Give feedback.
-
|
Qs. reg. (4) Are you sure you want to call it this, while the rest are named I think I can do what you want, but instead, I think My vote is for What's your vote? Also, and more importantly, if If we change the interface of those two to return I think that scheme could be continued as it is consistent with traditional |
Beta Was this translation helpful? Give feedback.
-
|
@rtjohnso : Based on above exchange, here's a revised nearly-final set of interfaces. I will reply to this post, listing each interface separately, so we can rebut each and resolve if there are still discrepancies to work through. |
Beta Was this translation helpful? Give feedback.
-
The proposed (tentative) interface for free is: This proposed interface requires that all clients that allocate memory will necessarily have to deal with a This has implications and affects clients that allocate large-memory from the heap even when shared-memory is configured. The code-level usage issues are best illustrated with an example: Currently (in this change-set), the new code chunks in What's happening is that in Later, before exiting, we do: Currently, in the change set, the free interface is: The body of the caller-macro
All this was done to retain the "convenience" for callers such as Going to the proposed simplified Yes, it seems brain-dead obvious that we should do this make-consistent rework, but just thought I'd air out the specific usage-issues around My vote: Yes, we can rework the change set now to require that Your call? |
Beta Was this translation helpful? Give feedback.
-
|
Qs. How do the TYPED APIs work now? Do you have to pass a memhandle to them? @rtjohnso -- This discussion sub-thread is w.r.t this question you raised in one of your earlier comments. The short-answer is: Yes, all the Long-answer is: However, they do it in sort-of a weird (or cute, depending on your point of view) way. |
Beta Was this translation helpful? Give feedback.
-
|
Update: @rtjohnso -- I have revised the implementation in PR #569 based on the discussions we've had so far. Following are the new interfaces at a high-level: I have made the required changes to the consumer code. Basic tests are passing on my Docker build. Right now draft PR #616 to shake out CI-jobs is going on. I expect it will succeed. Let me know if there are any other interface changes you'd like to bring up. I can implement them in this round before re-starting the review. Otherwise, once CI-jobs all pass, I will update the delta-diffs arising from this revision to the change-set in PR #569 and will request you to re-start the review. |
Beta Was this translation helpful? Give feedback.
-
|
Most changes arising from discussions so far have been applied to the change-set under PR #569 under this one single commit. Review can resume now. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This proposal comes from @rtjohnso , raised as part of his review comments for PR #569.
See this comment.
I think the current memfrag interface is leaky and not general.
I think the interface should look like this:
Proposal is as follows:
Original Proposal
Revised proposal
Original Proposal
Revised proposal
Original Proposal
Revised proposal
No changes from proposed interface.
Update: this may become unnecessary once we rework the remaining interfaces.
As for names, I would advocate renaming memfrag to memory_allocation.
Beta Was this translation helpful? Give feedback.
All reactions