Git Product home page Git Product logo

entitycomponentsystem's People

Contributors

tobias-stein avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

entitycomponentsystem's Issues

Header alignment in StackAllocator

Maybe is a misunderstanding but I think the header in the StackAllocator is placed at the beginning of the block, then there is an adjustment, and finally the new data (to which the pointer is returned).

That, as I understand it, leaves the header unreachable since the adjustment length is what the header is.

                                                 +---- aligned mem pos. (and pointer returned by the allocator)
                                                 v
| o l d · d a t a | adj | e m p t y · s p a c e | n e w · d a t a| 
                                DE AD BE EF

So when freeing the memory the adjustement isn't next to the new data.

Despite no incidence when aligning on a per byte strategy. Which I believe is the case:

Read in ECSMM.h: 62

void* pMemory = m_MemoryAllocator->allocate(memSize, alignof(u8));

with other alignments will corrupt the free operation with a wild pointer.

I'd like to suggest changing

StackAllocator.cpp: 49

		// store alignment in allocation meta info
		asMeta->adjustment = adjustment;

		// determine aligned memory address
		asUptr += adjustment;

to

	// determine aligned memory address
	asUptr += adjustment;

	// store alignment in allocation meta info in the previous block
	(asMeta-1)->adjustment = adjustment;
	/*
	 * todo: move header before data
                            adjustment              asUptr new emplacement
	                            v                          v
	  | u·s·e·d  m·e·m·o·r·y || 0 | 1 | 2 | 3 | 4 | adj |  new data
	                                  ^
	                                  L empty bytes
	 */

since (asMeta-1) is pointer arithmetics measured in AllocMetaInfo size.

Thanks a lot for sharing your code. There isn't a single file in which I hadn't learn something about C++ programing.
Regards.

.

.

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.