blackhack / ardulibraries Goto Github PK
View Code? Open in Web Editor NEWUseful libraries for Arduino
Home Page: http://playground.arduino.cc//Main/LibraryList
License: MIT License
Useful libraries for Arduino
Home Page: http://playground.arduino.cc//Main/LibraryList
License: MIT License
Thanks
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!
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() {}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.