Pre-Allocate Memory?
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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