{"id":31811199,"url":"https://github.com/ezequias2d/ez","last_synced_at":"2026-05-14T21:34:25.912Z","repository":{"id":46831173,"uuid":"357148974","full_name":"ezequias2d/Ez","owner":"ezequias2d","description":"Ez libraries for memory management, object reuse and threading tasks.","archived":false,"fork":false,"pushed_at":"2022-01-05T05:08:55.000Z","size":785,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-20T13:11:04.297Z","etag":null,"topics":["csharp","dotnet","memory-allocation","memory-game","memory-management","reuseable","thread-pool","threading"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ezequias2d.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-12T10:21:13.000Z","updated_at":"2022-08-22T17:40:10.000Z","dependencies_parsed_at":"2022-09-24T17:56:58.143Z","dependency_job_id":null,"html_url":"https://github.com/ezequias2d/Ez","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ezequias2d/Ez","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ezequias2d%2FEz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ezequias2d%2FEz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ezequias2d%2FEz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ezequias2d%2FEz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ezequias2d","download_url":"https://codeload.github.com/ezequias2d/Ez/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ezequias2d%2FEz/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006451,"owners_count":26084107,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","dotnet","memory-allocation","memory-game","memory-management","reuseable","thread-pool","threading"],"created_at":"2025-10-11T06:39:48.836Z","updated_at":"2025-10-11T06:39:53.185Z","avatar_url":"https://github.com/ezequias2d.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ez\n[![NuGet Version](https://img.shields.io/nuget/v/Ez)](https://nuget.org/packages/Ez)\n\nThis project contains a set of APIs used to implement other Ez.* libraries whose goals are to try to provide a varied and working API for things that may or may not be objectionable.\n\nSometimes you can find more experimental things like DiscontiguousList, which hasn't been tested as meticulously and may contain a lot of bugs.\n\nBelow is some detail, even if summarized, of some things in this repository.\n\n## Ez namespace\nThis is the base namespace of all Ez APIs.\n\n### Disposable \nAbstract class that provides an implementation of IDisposable interface for classes that need to discard unmanaged and managed resources.\n\n### IResettable\nInterface to be used commonly between objects that can be reset and set.\n\nThe intended use of the methods is **Set** being a method that prepares the object for use and **Reset** that causes the object itself to be defined or collected by the GC.\n\n### IClone\nInterface that provides the possibility to clone the object itself to a specific type using a property.\n\n### Messager namespace (experimental)\nThis API provides dynamic messages between objects using reflection.\n\n#### DynamicMessengerRecipient\nA class that parses methods that support preconfigured events and can be called dynamically.\n\n#### MessengerSender\nA static class for autogenerate DynamicMessengerRecipient and \"SendMessenger\".\n\n\n\n### Memory namespace\nThis API contains some classes, interfaces and structures that are somehow memory related.\n\n#### MemUtil\nStatic class with useful methods for memory manipulation, like SizeOf, Equals, Set, Copy, Alloc and Free.\n\n##### SizeOf\n```csharp\npublic static uint SizeOf\u003cT\u003e() where T : unmanaged;\n\npublic static long SizeOf\u003cT\u003e(ReadOnlySpan\u003cT\u003e span) where T : unmanaged;\n```\n\n##### Equals\n```csharp\npublic static bool Equals\u003cT\u003e(ReadOnlySpan\u003cT\u003e a, ReadOnlySpan\u003cT\u003e b) where T: unmanaged;\n\npublic static bool Equals\u003cT\u003e(ReadOnlySpan\u003cT\u003e a, ReadOnlySpan\u003cT\u003e b) where T: unmanaged;\n\npublic static unsafe bool Equals(void* a, void* b, long byteCount);\n```\n\n##### Set\n```csharp\npublic static void Set\u003cT\u003e(Span\u003cT\u003e span, byte value) where T : unmanaged;\n\npublic static unsafe void Set(void* memoryPtr, byte value, long byteCount);\n\npublic static void Set(IntPtr memoryPtr, byte value, long byteCount);\n\npublic static unsafe void Set\u003cT\u003e(IntPtr ptr, in T value, long count) where T : unmanaged;\n```\n\n##### Copy\n```csharp\npublic static long Copy\u003cT\u003e(Span\u003cT\u003e destination, ReadOnlySpan\u003cT\u003e source) where T : unmanaged;\n\npublic static long Copy\u003cT\u003e(Span\u003cT\u003e destination, IntPtr source) where T : unmanaged;\n\npublic static long Copy\u003cTDestination, TSource\u003e(Span\u003cTDestination\u003e destination, ReadOnlySpan\u003cTSource\u003e source) \n            where TDestination : unmanaged \n            where TSource : unmanaged;\n\npublic static unsafe long Copy\u003cT\u003e(IntPtr dst, ReadOnlySpan\u003cT\u003e src) where T : unmanaged;\n\npublic static unsafe long Copy\u003cT\u003e(void* dst, ReadOnlySpan\u003cT\u003e src) where T : unmanaged;\n\npublic static long Copy\u003cT\u003e(IntPtr dst, in T src) where T : unmanaged;\n\npublic static unsafe void Copy(IntPtr destination, IntPtr source, long byteCount);\n\npublic static unsafe void Copy(void* destination, void* source, long byteCount);\n```\n\n##### Alloc \n```csharp\npublic static unsafe IntPtr Alloc(long size);\n```\n\n##### Free\n```csharp\npublic static unsafe void Free(IntPtr ptr);\n```\n\n\n#### MemoryBlock, MemoryBlockPool and EphemeralMemoryBlock\nA MemoryBlock is literally a class to allocate a block of memory for any purpose.\n\nIts closest relative, EphemeralMemoryBlock, is a wrapper over a MemoryBlock that has the limitation imposed by the ref structure of being placed on the stack that guarantees that the instance has not been maintained by any method that takes it as an argument.\n\nAnd finaly, MemoryBlockPool, a pool for MemoryBlock, there's not much to explain, you Get when you need it and Return it when you don't use it.\n\n##### IMemoryBlock\nSo both MemoryBlock and EphemeralMemoryBlock implement the IMemoryBlock interface which provides a simple way to suballocate memory blocks, IDisposable to free memory and IResettable to reset suballocations.\n\n```csharp\ninterface IMemoryBlock : IDisposable, IResettable\n{\n    long RemainingSize { get; }\n\n    long TotalSize { get; }\n\n    long TotalUsed { get; }\n\n    IntPtr Ptr { get; }\n\n    bool TryAlloc(long size, out IntPtr ptr);\n\n    IntPtr AllocIntPtr(long size);\n\n    PinnedMemory\u003cT\u003e AllocPinnedMemory\u003cT\u003e(int length) where T : unmanaged;\n\n    bool TryAllocPinnedMemory\u003cT\u003e(int length, out PinnedMemory\u003cT\u003e memory) where T : unmanaged;\n}\n```\n\n\n### Threading namespace\nThis API contains two thread-related classes.\n\n#### SingleTaskScheduler\nThis class implements the abstract class TaskScheduler(from System.Threading.Tasks) to run tasks in a single thread.\n\n#### ThreadMethodExecutor \nThis class encapsulates a SingleTaskScheduler and a TaskFactory in an interface for creating and executing tasks.\n\n\n## Thanks\n\nIf you've read this far, I don't know what to say other than have a nice day and I'm excited to know if anything here was helpful.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fezequias2d%2Fez","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fezequias2d%2Fez","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fezequias2d%2Fez/lists"}