Open
Conversation
Collaborator
Internal API ChangedAdded: 8, Removed: 0, Changed: 0Added+ /// <since_tizen>none</since_tizen
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Tizen.NUI.BaseComponents.AnimatedImageView/AnimationStates Tizen.NUI.BaseComponents.AnimatedImageView::AnimationState()
+ /// <since_tizen>none</since_tizen
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ System.Void Tizen.NUI.BaseComponents.AnimatedImageView::Pause()
+ /// <since_tizen>none</since_tizen
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ System.Void Tizen.NUI.BaseComponents.AnimatedImageView::Play()
+ /// <since_tizen>none</since_tizen
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ System.Void Tizen.NUI.BaseComponents.AnimatedImageView::Stop()
+ /// <since_tizen>none</since_tizen
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Tizen.NUI.BaseComponents.AnimatedImageView/AnimationStates
+ /// <since_tizen>none</since_tizen
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ static Tizen.NUI.BaseComponents.AnimatedImageView/AnimationStates Tizen.NUI.BaseComponents.AnimatedImageView/AnimationStates::Paused
+ /// <since_tizen>none</since_tizen
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ static Tizen.NUI.BaseComponents.AnimatedImageView/AnimationStates Tizen.NUI.BaseComponents.AnimatedImageView/AnimationStates::Playing
+ /// <since_tizen>none</since_tizen
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ static Tizen.NUI.BaseComponents.AnimatedImageView/AnimationStates Tizen.NUI.BaseComponents.AnimatedImageView/AnimationStates::Stopped
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace Marshal.AllocHGlobal with stackalloc/fixed for low-risk interop patterns
Description
As part of .NET 8 refactoring, this PR replaces
Marshal.AllocHGlobal+Marshal.StructureToPtr+Marshal.FreeHGlobalinterop marshaling patterns withstackalloc/fixedto eliminate heap allocations.We classified ~229 Marshal usage sites across TizenFX into 5 risk levels and applied changes only to the safest (Level 5) patterns.
Why was
Marshal.AllocHGlobalused in the first place?.NET's GC (Garbage Collector) may relocate managed memory during heap compaction. If a managed array's address is passed directly to a native C function, the GC could move that array while the native function is still using it, causing a dangling pointer crash.
Marshal.AllocHGlobalallocates on the unmanaged heap, which the GC never touches — making it safe to pass to native code.Downsides: heap allocation overhead + data copy cost + manual free required (missing free = memory leak).
Why are
unsafeblocks needed?Both
stackallocandfixeduse C# pointer operations, which require anunsafecontext.stackallocfixedBoth eliminate copy + allocation cost compared to
AllocHGlobaland cannot leak memory (no manual Free needed).Changes
Tizen.Security.SecureRepository
SafeCipherParametersHandle.SetBufferAllocHGlobal+StructureToPtr+FreeHGlobal→stackalloc(single blittable struct)UIntPtrfields — confirmed blittableParamListSetBuffer) returns immediately → matches stack lifetimeTizen.Location
PolygonBoundary constructor
AllocHGlobal+StructureToPtrloop →fixedpinning for direct array pass[StructLayout(LayoutKind.Sequential)]withdouble× 2 — confirmed blittableFreeHGlobalcall → memory leak fixedcsproj
<AllowUnsafeBlocks>true</AllowUnsafeBlocks><AllowUnsafeBlocks>true</AllowUnsafeBlocks>Risk Analysis & Selection Criteria
Out of ~229 total Marshal usage sites, only Level 5 (Low risk) patterns were applied:
GC Relocation Verification
stackallocfixedBenchmark Results (on-device, Raspberry Pi 4)
Tested with 100,000 iterations per benchmark on a Tizen rpi4 target device.
Single Struct — CkmcRawBuffer pattern
AllocHGlobal+StructureToPtr+FreeHGlobalstackallocStruct Array[50] —
Coordinate[]patternAllocHGlobal+StructureToPtr× 50 +FreeHGlobalfixedpinningNotes for Reviewers
FreeHGlobalmissing) is naturally fixed by this change