A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-June/045607.html below:

[Python-Dev] Possible memory leak in typeobject.c?

[Python-Dev] Possible memory leak in typeobject.c? [Python-Dev] Possible memory leak in typeobject.c?Eric Huss ehuss at ironport.com
Fri Jun 25 17:37:16 EDT 2004
While tearing my hair out trying to figure out why my dynamically
allocated type objects weren't getting garbage collected, I noticed that
the tp_new_wrapper object had 1 too many ref counts.

Does the following patch make sense?  Seems fairly straightforward to me.

-Eric
-------------- next part --------------
*** typeobject.c	28 May 2004 18:36:03 -0000	1.3
--- typeobject.c	25 Jun 2004 21:23:15 -0000
***************
*** 3923,3929 ****
  	func = PyCFunction_New(tp_new_methoddef, (PyObject *)type);
  	if (func == NULL)
  		return -1;
! 	return PyDict_SetItemString(type->tp_dict, "__new__", func);
  }
  
  /* Slot wrappers that call the corresponding __foo__ slot.  See comments
--- 3923,3934 ----
  	func = PyCFunction_New(tp_new_methoddef, (PyObject *)type);
  	if (func == NULL)
  		return -1;
! 	if(PyDict_SetItemString(type->tp_dict, "__new__", func)) {
! 		Py_DECREF(func);
! 		return -1;
! 	}
! 	Py_DECREF(func);
! 	return 0;
  }
  
  /* Slot wrappers that call the corresponding __foo__ slot.  See comments
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4