Ticket #4740 (needs_work defect)

Opened 21 months ago

Last modified 3 months ago

[with patch, needs work] avoid creating unneeded homsets when coercing

Reported by: mabshoff Owned by: robertwb
Priority: major Milestone: sage-4.5.3
Component: memleak Keywords:
Cc: burcin, robertwb Author(s):
Report Upstream: N/A Reviewer(s):
Merged in: Work issues:

Description

Burcin reported at #4639:

sage: F = GF(13)
sage: get_memory_usage()
708.02734375
sage: for _ in xrange(10000):
....:     t = F.coerce(F(234234))
....:     
sage: get_memory_usage()
728.15234375
sage: for _ in xrange(100000):
    t = F.coerce(F(234234))
....:     
sage: get_memory_usage()
932.3125
sage: for _ in xrange(100000):
    t = F.coerce(F(234234))
....:     
sage: get_memory_usage()
1136.35546875

Since the patch by RobertWB at that ticket fixes the issue Burcin reported, but not the original one I am moving it over to this ticket.

Cheers,

Michael

Attachments

trac_4740_coerce-leak.patch Download (1.7 KB) - added by mabshoff 21 months ago.
Patch by RobertWB, originally from #4639

Change History

Changed 21 months ago by mabshoff

Patch by RobertWB, originally from #4639

  Changed 21 months ago by mabshoff

  • summary changed from Fix memory leak in finite field coercion to [with patch, positive review] Fix memory leak in finite field coercion

Patch by RobertWB, review by William.

Cheers,

Michael

  Changed 21 months ago by mabshoff

  • summary changed from [with patch, positive review] Fix memory leak in finite field coercion to [with patch, needs work] Fix memory leak in finite field coercion

This patch causes a failure with the pickle jar:

**********************************************************************
File "/scratch/mabshoff/release-cycle/sage-3.2.2.alpha1/devel/sage/sage/structure/sage_object.pyx", line 371, in __main__.example_16
Failed example:
    sage.structure.sage_object.unpickle_all(std)###line 682:_sage_    >>> sage.structure.sage_object.unpickle_all(std)
Expected:
    doctest:...: DeprecationWarning: Your data is stored in an old format. Please use the save() function to store your data in a more recent format.
    Successfully unpickled ... objects.
    Failed to unpickle 0 objects.
Got:
    doctest:1172: DeprecationWarning: Your data is stored in an old format. Please use the save() function to store your data in a more recent format.
    ** failed:  _class__sage_rings_finite_field_morphism_FiniteFieldHomset__.sobj
    Failed:
    _class__sage_rings_finite_field_morphism_FiniteFieldHomset__.sobj
    Successfully unpickled 453 objects.
    Failed to unpickle 1 objects.
**********************************************************************
1 items had failures:
   1 of   7 in __main__.example_16

Cheers,

Michael

  Changed 21 months ago by mabshoff

  • cc robertwb added
  • priority changed from major to blocker
  • milestone changed from sage-3.4 to sage-3.2.2

Once the pickling issue is fixed this should go in.

Cheers,

Michael

  Changed 21 months ago by mabshoff

  • milestone changed from sage-3.4 to sage-3.2.3

Robert,

the leak seems to be gone in 3.2.2:

----------------------------------------------------------------------
| Sage Version 3.2.2, Release Date: 2008-12-18                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: F = GF(13)
sage: get_memory_usage()
689.02734375
sage: for _ in xrange(10000):
....:     t = F.coerce(F(234234))
....:     
sage: get_memory_usage()
689.02734375
sage: for _ in xrange(100000):
....:     t = F.coerce(F(234234))
....:     
sage: get_memory_usage()
689.02734375
sage: for _ in xrange(100000):
....:     t = F.coerce(F(234234))
....:     
sage: get_memory_usage()
689.02734375
sage: 

Should we close this ticket as won't fix or is the patch her still relevant? In that case we should update the ticket to reflect the actual issue being fixed here.

Cheers,

Michael

follow-up: ↓ 7   Changed 21 months ago by robertwb

  • priority changed from blocker to major
  • milestone changed from sage-3.2.3 to sage-3.4

The patch is still relevant here. What is going on is every time coerce is called, a new homset is created. Creating a new homset doesn't leak anymore, but it's still sub-optimal.

I don't know that I'll have time to look into this anytime soon, but it's not a blocker anymore as the leak is solved elsewhere.

  Changed 21 months ago by mabshoff

  • summary changed from [with patch, needs work] Fix memory leak in finite field coercion to [with patch, needs work] avoid creating unneeded homsets when coercing

ok,

I renamed the ticket then.

Cheers,

Michael

in reply to: ↑ 5   Changed 3 months ago by SimonKing

  • upstream set to N/A

Hi Robert,

accidentally I found this rather old ticket.

Replying to robertwb:

The patch is still relevant here. What is going on is every time coerce is called, a new homset is created. Creating a new homset doesn't leak anymore, but it's still sub-optimal.

Is this still the case? In what situation is the homset created? Is it not cached? In what files does it occur?

Cheers, Simon

Note: See TracTickets for help on using tickets.