sta / sta/websocket-sharp

Pre-Allocate Memory?

Open
#238 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
6.1k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

Hi,

I'm running websocket-sharp in Unity 5.4 for a virtual reality application. Among other things, I am streaming image data at 10 hz to Unity from another computer through websockets. Every second and a half or so, however, the garbage collector calls and I lose 10 or more frames, which is unacceptably uncomfortable for a VR program. The websocket client seems to be generating a lot of wasted memory from the image data received. Is there any way to specify to websocket-sharp to pre-allocate some memory in a pool and only save to the locations in that pool when receiving messages? The messages received are the same length every time, so I could provide that to a constructor if necessary.

If changes are necessary but you can't provide them yourself, where would I begin making such changes?

Thanks!
Zoe

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the websocket client’s receive path and how fixed-length image messages are stored and released. Determine whether a caller-configurable memory pool is feasible without changing message behavior; done means the allocation approach is specified and verified for repeated image receives.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.