You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the section "Allocate a MemorySegment with an Arena", the text "should be deallocated and no longer valid." is missing the word "is". It should be "Each arena has a scope, which specifies when the off-heap memory (associated with the MemorySegment object) should be deallocated and is no longer valid."
The section "Print a Value Stored in the Off-Heap Memory" contains the text "With the methods within MemorySegment interface" which is missing "the" (and a comma at the end). It should be "With the methods within the MemorySegment interface, , you can read from or write to memory segments."
In the same section, "For example, MemoryLayout.get(ValueLayout.OfByte,long) takes as an argument ValueLayout.JAVA_BYTE" refers to a nonexistent method. I assume it should be MemorySegment instead of MemoryLayout.
The codeblock at the end of that article contains the following code:
The first sentence contains "As Foreign Function and Memory API can help you" which is missing a missing "the" It should be "As the Foreign Function and Memory API can help you with invoking native code,"
The first codeblock in the section "Locate the Address of the C Function" mentions "libc.so.6" which probably doesn't work on Windows. It might be a good idea to add a comment orr similar to avoid confusion (or mention the Windows DLL providing that function).
The same codeblock also contains the line "MemorySegment strlen_addr = stdLib.find("strdup").get(); ". This MemorySegment is named strlen_addr even though the function is not strlen.
The section "Describe the C Function Signature" contains invalid links to StructLayout and UnionLayout (starting with javadoc:). This is likely due to using inline Markdown codeblocks within links
The first paragraph of this article contains "An elegant solution is to use memory layouts that are more efficiently to initialize and can access more complex native data types such as C structures." - What's meant with "are more efficiently"?
In the final code snippet of the first section, the line "resultDenominator = d1 * d2;" references variables that are not declared at that point. I think this line should be removed.
The second codeblock in the section "Create a Downcall Method Handle for the Foreign Function" contains a declaration "final static Linker linker". Since most people put static before final, I suggest reordering that.
The first section of this article contains the sentence "While not directly accessible, the goal of a zero-length memory segments is to pass them to other pointer-accepting foreign functions". I think the article "a" is incorrect there due to the plural afterwards and should therefore be removed.
The table at the end of that article (listing restricted methods) is out of bounds on small screens (e.g. mobile phones).
The teapot code uses the line glutInit(argc, argc);. Iss it intentional that argc is used twice there? While it shouldn't matter (because argc is 0), I think this should at least be explained (or replaced by another MemorySegment).
The text was updated successfully, but these errors were encountered:
Thank you for taking the time for reporting these typos. Most of them were addressed.
What's meant with "are more efficiently"?
As the previous article in the series explained working with MemorySegment, that paragraph references the knowledge previously gained as a way to deal with structured data. It is possible to use multiple MemorySegmentobjects to describe the same as MemoryLayout would, but that makes the code more complicated to maintain, hence less efficient.
There are a few typos and similar issues in the new FFM tutorials.
https://dev.java/learn/ffm/access-memory/
In the section "Allocate a MemorySegment with an Arena", the text "should be deallocated and no longer valid." is missing the word "is". It should be "Each arena has a scope, which specifies when the off-heap memory (associated with the MemorySegment object) should be deallocated and is no longer valid."
The section "Print a Value Stored in the Off-Heap Memory" contains the text "With the methods within MemorySegment interface" which is missing "the" (and a comma at the end). It should be "With the methods within the MemorySegment interface, , you can read from or write to memory segments."
In the same section, "For example, MemoryLayout.get(ValueLayout.OfByte,long) takes as an argument ValueLayout.JAVA_BYTE" refers to a nonexistent method. I assume it should be
MemorySegment
instead ofMemoryLayout
.The codeblock at the end of that article contains the following code:
Here,
nativeString
is declared within the try-with-resources block so accessing the variable outside is a compiler-error.https://dev.java/learn/ffm/native/
The first sentence contains "As Foreign Function and Memory API can help you" which is missing a missing "the" It should be "As the Foreign Function and Memory API can help you with invoking native code,"
The first codeblock in the section "Locate the Address of the C Function" mentions "libc.so.6" which probably doesn't work on Windows. It might be a good idea to add a comment orr similar to avoid confusion (or mention the Windows DLL providing that function).
The same codeblock also contains the line "MemorySegment strlen_addr = stdLib.find("strdup").get(); ". This
MemorySegment
is namedstrlen_addr
even though the function is notstrlen
.The section "Describe the C Function Signature" contains invalid links to
StructLayout
andUnionLayout
(starting withjavadoc:
). This is likely due to using inline Markdown codeblocks within linkshttps://dev.java/learn/ffm/access-structure/
The first paragraph of this article contains "An elegant solution is to use memory layouts that are more efficiently to initialize and can access more complex native data types such as C structures." - What's meant with "are more efficiently"?
In the final code snippet of the first section, the line "resultDenominator = d1 * d2;" references variables that are not declared at that point. I think this line should be removed.
https://dev.java/learn/ffm/upcall/
The second codeblock in the section "Create a Downcall Method Handle for the Foreign Function" contains a declaration "final static Linker linker". Since most people put
static
beforefinal
, I suggest reordering that.https://dev.java/learn/ffm/troubleshoot/
The first section of this article contains the sentence "While not directly accessible, the goal of a zero-length memory segments is to pass them to other pointer-accepting foreign functions". I think the article "a" is incorrect there due to the plural afterwards and should therefore be removed.
The table at the end of that article (listing restricted methods) is out of bounds on small screens (e.g. mobile phones).
https://dev.java/learn/ffm/jextract/
The teapot code uses the line
glutInit(argc, argc);
. Iss it intentional thatargc
is used twice there? While it shouldn't matter (because argc is0
), I think this should at least be explained (or replaced by anotherMemorySegment
).The text was updated successfully, but these errors were encountered: