This is completely fictional. Carrying small knives or daggers was very common for all classes of people in medieval life, simply because there's a great many tasks and daily uses where it might be handy to have a small knife. For boys in the aristocracy, a finely made dagger was yet another accoutrement that could be used to display wealth and status, essentially jewelry. You can see a quite beautifully decorated example of an ear dagger in this painting of Edward VI. But these were never intended for suicide and to give children such a thing specifically for the purpose of killing themselves would be anathema to medieval people.
If medieval noble children were to be captured or at risk of capture, they would generally be taken alive for ransom, not killed or tortured. For example, Philip, son of the King of France (later known as the Bold) was 14 when he participated in the Battle of Poitiers and was captured along with his father. The Wars of the Roses in England does provide several cases of killing children under 18: most famously, the murder of the princes in the Tower of London and the death of Edward of Lancaster after the Yorkist triumph at Tewkesbury. But these killings were notable to contemporaries because they were so unusual, punctuation to the vicious feuds of civil war.