Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7458921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T13:49:49+00:00 2026-05-29T13:49:49+00:00

My team is working on an MMO server in Ruby, and we opted to

  • 0

My team is working on an MMO server in Ruby, and we opted to start moving computationally intensive operations into a C extension. As part of that effort, we moved the actual data storage into C (using Data_Get_Struct and all that). So, for example, each Ruby “Zone” object has an associated “ZoneKernel::Zone” C struct where the actual binary data is stored.

Basically, I’m wondering if this is a terrible idea or not. I’m not super familiar with the ruby internals, but it seems like the data should be fine as long as the parent Zone stays in memory on the ruby side (thus preventing garbage collection of the C data).

One caveat is that we’ve been getting semi-regular “Stack Consistency Errors” that crash our server – this seems like potentially a related memory issue (instead of just your garden variety segfault) – if anyone has any knowledge of what that might be, I would appreciate that as well!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T13:49:52+00:00Added an answer on May 29, 2026 at 1:49 pm

    As stated in the documentation to Data_Wrap_Struct(klass, mark, free, ptr) function:

    The free argument is the function to free the pointer allocation. If
    this is -1, the pointer will be just freed.

    These mark / free functions are invoked during GC execution.

    Your wrapped native structure will be automatically freed when its corresponding Ruby object is finalized. Until that happens, your data will not be freed unless you do so manually.

    Writing C extensions doesn’t guarantee a performance boost, but it almost always increases the complexity of your code. Profile your server in order to measure your performance gains, and develop your Zone class in pure Ruby if viable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm part of a development team working on a job board, and we're considering
Our team is working on a new application that we started with Rails 3.1
We're a small dev team working with some GLSL that may be too large
Like most shops we've got a team of people working on various projects that
My team working in a project using Winforms application(c#) & MSSQL 2005 as database.
There is a team working on acceptance testing X11 GUI application in our company,
I'm in a 10 person team working on a large legacy code base with
Has anybody any successful remarks about having a team working via Remote Desktop? In
My team is working on a crappy old website and most of the pages
My team is working on a conversion project to convert one product (but with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.