Coder Social home page Coder Social logo

Comments (3)

tmsimont avatar tmsimont commented on May 19, 2024

Are you sure about this?

I ran with this trace: https://www.cs.utexas.edu/~fussell/courses/cs352.fall98/Homework/cc1.din.Z and Valgrind doesn't think there are any leaks:

==26852== Memcheck, a memory error detector
==26852== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==26852== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==26852== Command: ./main
==26852==
==26852==
==26852== HEAP SUMMARY:
==26852==     in use at exit: 0 bytes in 0 blocks
==26852==   total heap usage: 24,846 allocs, 24,846 frees, 828,804 bytes allocated
==26852==
==26852== All heap blocks were freed -- no leaks are possible
==26852==
==26852== For counts of detected and suppressed errors, rerun with: -v
==26852== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

from cache-simulator.

tmsimont avatar tmsimont commented on May 19, 2024

When you pass to a.cacheRead(address(addr)) or a.cacheWrite(address(addr)) you're just passing a copy of a new instance, not a pointer (which would be a.cacheRead(new address(addr)))

The read/write functions use the copy from the stack frame and it is cleaned up when that frame is removed.

When you pass these around from the read/write functions, you're not passing pointers or addresses, so it looks like you're copying out to other functions, too.

from cache-simulator.

tmsimont avatar tmsimont commented on May 19, 2024

Also I don't think Address() is even necessary if we move index/offset/tag parse responsibility to the cache ( #1 )

from cache-simulator.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.