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

  • Home
  • SEARCH
  • 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 262745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:32:36+00:00 2026-05-11T22:32:36+00:00

I have a pretty complex object graph G with an object o1 in G

  • 0

I have a pretty complex object graph G with an object o1 in G. G is to be written into a database using NHibernate. However, if there already is a persistent entry of o1 (let’s call it o1_p ) in the database, I substitute o1 for o1_p. Hence there should be no redundant entries in the database. Now I let NHibernate do its job and afterwards I look into the database. Now I have exactly the situation I tried to avoid. There are entries for the original o1_p object plus o1 in the database. The only explanation I have so far is that o1 is reachable via another route in G so hibernate puts it into the database. Is there a way I can determine if this is the case, i.e. can I ask the garbage collector how many references there are to o1. Or to speak in graph language: How many incoming edges does o1 have?

  • 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-11T22:32:36+00:00Added an answer on May 11, 2026 at 10:32 pm

    No, you can’t ask the garbage collector how many references there are to o1: .NET doesn’t use reference counting.

    Basically you’d have to do all the graph navigation yourself, which will probably mean making your object graph implement some sort of visitor algorithm, combined with a cache of objects you’ve already examined. And yes, this is similar to what the GC would do, but I don’t believe there’s any way of hooking into its processing. (And there are probably edge cases involving special tricks where the GC knows something isn’t garbage and ignores it anyway, which wouldn’t be suitable for your code.)

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

Sidebar

Ask A Question

Stats

  • Questions 524k
  • Answers 524k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer if(User.Identity.IsAuthenticated) { someLabel.Text = Membership.GetUser().Email; } There are a lot… May 16, 2026 at 10:05 pm
  • Editorial Team
    Editorial Team added an answer Where is the local JVM getting the code that should… May 16, 2026 at 10:05 pm
  • Editorial Team
    Editorial Team added an answer If you read the API, you'll see the following example:… May 16, 2026 at 10:05 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a pretty complex object and I need to get uniqueness of these
I have a pretty complex Linq statement with multiple joins, but am having a
I have a fairly complex object (deserialized json, so I don't have too much
I have a fairly complex application which has been broken up into multiple components.
I have a MarshalByRefObject which I needed to serialize and store (in a database),
I have been working with some complex PDF outputs with reportlab. These are generally
I have built a fairly complex form which includes a hidden section that the
I need to persist an object that is not marked with the serializable attribute.
I have wxPython app which is running on MS Windows and I'd like it
It is an iPad app based on SDK 3.2. I have a MainUIView, that

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.