handles: use real pointers to keep track of handles #296

Merged
carlosmn merged 1 commits from cmn/track-real-pointers into master 2016-02-18 11:43:56 -06:00
carlosmn commented 2016-02-18 10:10:18 -06:00 (Migrated from github.com)

With the change to 1.6 rules, we couldn't use the Go pointers, so we
went with casting the list indices into pointers.

The runtime does not like this, however. It will sometimes detect that
we have a pointer with a very small value and consider it an invalid
pointer, bringing down the application with it.

Work around that by asking libc for the smallest amount of memory it'll
give us so we have an actual allocated pointer to use. We then use this
pointer value as the key in our map to find the Go object we're
tracking.

With the change to 1.6 rules, we couldn't use the Go pointers, so we went with casting the list indices into pointers. The runtime does not like this, however. It will sometimes detect that we have a pointer with a very small value and consider it an invalid pointer, bringing down the application with it. Work around that by asking libc for the smallest amount of memory it'll give us so we have an actual allocated pointer to use. We then use this pointer value as the key in our map to find the Go object we're tracking.
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: jcarr/git2go#296
No description provided.