GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - FullstackSensei/NativePool: Allocate managed objects in a object pool, backed by native memory buffer.

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

2 Commits
2 Commits

Folders and files

NameName
Last commit message
Last commit date
.vscode
.vscode
 
 
.gitignore
.gitignore
 
 
Heap.cs
Heap.cs
 
 
NativePool.cs
NativePool.cs
 
 
NativePool.csproj
NativePool.csproj
 
 
Program.cs
Program.cs
 
 
README.md
README.md
 
 
UnsafeUtils.cs
UnsafeUtils.cs
 
 
omnisharp.json
omnisharp.json
 
 

Repository files navigation

NativePool

What?

Allocate managed objects (reference type) in a object pool, backed by native memory buffer (Marshal.AllocHGlobal).

Why?

Because why not? Maybe I was drunk or sleep-coding?

When?

  1. You should not use it.
  2. If you use it, your right to write software will likely be revoked.
  3. Forget about this repo, unless you are an expert in C#, CLR, and have a legit strong reason to use it.
  4. Compatibility? Memory safety? Is it edible?
  5. Mono is not supported. Yet. Maybe never.

How?

See Program.cs for example.

NativeObject: Base type for target objects. Implements IDisposable for easy deallocation.

NativePool<T>: The object pool itself. Specify number of objects per block and number of initial blocks at creation. Hopefully thread-safe.

T New(), void Free(T): Allocation and deallocation function. Cthulhu will appear when you double free or use after free.

void Dispose(bool force): Dispose the object pool and free all objects in pool. Validate no active objects in pool by default, unless force is specified.

PoolEnumerator GetEnumerator(): Enumerate all active objects in pool by memory order.

License

Public domain. I'm not responsible for any problems.

I really don't want to say I wrote this code.

About

Allocate managed objects in a object pool, backed by native memory buffer.

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.