Giter Site home page Giter Site logo

ardulibraries's People

Contributors

blackhack avatar jamesfowkes 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ardulibraries's Issues

crashes after N items have been added?

The code below on an Uno crashes after ~60 iterations of adding an instance of foo to the list.

This is a minimized version of the code I'm developing right now. My initial feeling is that I've messed up a pointer somewhere (it's been a while since I worked in raw C++, forgive me) so please point it out if I've done something moronic somewhere, I can't spot it.

Otherwise, varying the size of the s variable make it crash quicker the longer the string is, but the total size of an instance of foo with s=="s" should be really small, so I can't see how I'd exceed the available memory at 60 instances.

Here's the sketch output size info:
Sketch uses 4,068 bytes (12%) of program storage space. Maximum is 32,256 bytes.

Global variables use 302 bytes (14%) of dynamic memory, leaving 1,746 bytes for local variables. Maximum is 2,048 bytes.

Thanks!

include <Arduino.h>

include "SimpleList.h"

class foo
{
public:
String* s;
foo(void)
{
//the size of this string can be reduced, the longer it is, the quicker the crash- it's not just an issue because it's a long string
//this one takes ~13 iterations to die
//s=new String("sdfsdfhjfhgvbjkhlyuithgdfcnbvmj,hlkiyuitythdgcvnbm,jhlyuityurthgcnbvm,jhliyuityrhgdcnbvm,jhlyuityurthgcnbvmj,hluyityurthdgcvnbmj,hkuytiyfghvhjkuyitufg");
//this string makes it take 60 iterations
s=new String("s");
}
};
void setup()
{
Serial.begin(19200);
SimpleList<foo*>* list = new SimpleList<foo*>();
//list->reserve(100); //reserving up front doesn't seem to matter
for(int i=0; i<60; i++)
{
foo* f = new foo();
list->push_back(f);
}
}
void loop() {}

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.